repo_id
stringclasses
409 values
prefix
large_stringlengths
34
36.3k
target
large_stringlengths
1
498
assertion_type
stringclasses
31 values
difficulty
stringclasses
8 values
test_file
stringlengths
10
121
test_function
stringlengths
1
104
test_class
stringlengths
0
51
lineno
int32
2
11.3k
commit_idx
int32
sql-hkr/tiny8
import pytest from tiny8.cpu import SREG_C, SREG_Z class TestCompare: def test_cpse_no_skip_if_not_equal(self, cpu_with_program, helper): """Test CPSE doesn't skip when not equal.""" cpu = cpu_with_program(""" ldi r0, 42 ldi r1, 43 ldi r2, 0 cpse r0...
99)
assert_*
numeric_literal
tests/test_control_flow.py
test_cpse_no_skip_if_not_equal
TestCompare
327
null
sql-hkr/tiny8
import io from unittest.mock import Mock, patch import pytest from tiny8 import CPU, assemble class TestVisualizerConfiguration: def test_visualizer_custom_parameters(self): """Test Visualizer with custom parameters.""" from tiny8.visualizer import Visualizer cpu = CPU() asm = a...
1
assert
numeric_literal
tests/test_ui_components.py
test_visualizer_custom_parameters
TestVisualizerConfiguration
491
null
sql-hkr/tiny8
from tiny8 import CPU, assemble class TestLogicalInstructions: def test_neg_instruction(self): """Test two's complement negation.""" cpu = CPU() asm = assemble(""" ldi r16, 1 neg r16 """) cpu.load_program(asm) cpu.run() assert cpu.re...
255
assert
numeric_literal
tests/test_cpu_core.py
test_neg_instruction
TestLogicalInstructions
92
null
sql-hkr/tiny8
import pytest class TestLDST: def test_st_ld_basic(self, cpu_with_program, helper): """Test storing and loading from memory.""" cpu = cpu_with_program(""" ldi r16, 100 ; Address ldi r17, 42 ; Value st r16, r17 ; Store value to MEM[100] ...
42)
assert_*
numeric_literal
tests/test_data_transfer.py
test_st_ld_basic
TestLDST
88
null
sql-hkr/tiny8
import io from unittest.mock import Mock, patch import pytest from tiny8 import CPU, assemble class TestCLIHelperFunctions: def test_format_hex_value(self): """Test hex value formatting logic.""" test_values = [0x00, 0xFF, 0x42, 0xAB] for val in test_values: hex_str = f"0x{va...
4
assert
numeric_literal
tests/test_ui_components.py
test_format_hex_value
TestCLIHelperFunctions
309
null
sql-hkr/tiny8
import pytest from tiny8.memory import Memory class TestMemoryBasicOperations: def test_ram_out_of_bounds_read(self): """Test RAM out of bounds read.""" mem = Memory(ram_size=10) with pytest.raises(
IndexError)
pytest.raises
variable
tests/test_memory.py
test_ram_out_of_bounds_read
TestMemoryBasicOperations
24
null
sql-hkr/tiny8
import pytest from tiny8 import assemble, assemble_file class TestNumberParsing: def test_parse_number_binary(self): """Test parsing binary immediate.""" from tiny8.assembler import _parse_number assert _parse_number("0b1111") ==
15
assert
numeric_literal
tests/test_assembler.py
test_parse_number_binary
TestNumberParsing
54
null
sql-hkr/tiny8
from tiny8 import CPU, assemble class TestConditionalBranches: def test_brmi_not_taken(self): """Test branch if minus when not taken.""" cpu = CPU() asm = assemble(""" ldi r16, 100 ldi r17, 50 sub r16, r17 brmi skip ldi r18, 1 ...
1
assert
numeric_literal
tests/test_cpu_branches.py
test_brmi_not_taken
TestConditionalBranches
26
null
sql-hkr/tiny8
import pytest from tiny8 import CPU, assemble class TestCPUExceptions: def test_invalid_instruction(self): """Test that invalid instruction raises NotImplementedError.""" cpu = CPU() cpu.program = [("INVALID_OP", ())] with
NotImplementedError, match="Instruction INVALID_OP not implemented")
pytest.raises
complex_expr
tests/test_cpu_edge_cases.py
test_invalid_instruction
TestCPUExceptions
18
null
sql-hkr/tiny8
import pytest from tiny8.cpu import SREG_C, SREG_Z class TestJMP: def test_conditional_jump_pattern(self, cpu_with_program, helper): """Test conditional execution with jumps.""" cpu = cpu_with_program(""" ldi r0, 10 ldi r1, 10 cp r0, r1 brne not_equ...
1)
assert_*
numeric_literal
tests/test_control_flow.py
test_conditional_jump_pattern
TestJMP
51
null
sql-hkr/tiny8
import pytest from tiny8 import assemble, assemble_file class TestNumberParsing: def test_parse_number_decimal(self): """Test parsing decimal immediate.""" from tiny8.assembler import _parse_number assert _parse_number("100") ==
100
assert
numeric_literal
tests/test_assembler.py
test_parse_number_decimal
TestNumberParsing
61
null
sql-hkr/tiny8
import pytest class TestLDI: def test_ldi_hex_binary_formats(self, cpu_with_program, helper): """Test different number formats in LDI.""" cpu = cpu_with_program(""" ldi r20, $FF ldi r21, 0xFF ldi r22, 0b11111111 ldi r23, 255 """) for ...
255)
assert_*
numeric_literal
tests/test_data_transfer.py
test_ldi_hex_binary_formats
TestLDI
30
null
sql-hkr/tiny8
import pytest from tiny8 import assemble from tiny8.cpu import SREG_C, SREG_H, SREG_N, SREG_S, SREG_V, SREG_Z class TestDIV: def test_div_with_remainder(self, cpu_with_program, helper): """Test division with remainder.""" cpu = cpu_with_program(""" ldi r2, 100 ldi r3, 7 ...
2)
assert_*
numeric_literal
tests/test_arithmetic.py
test_div_with_remainder
TestDIV
351
null
sql-hkr/tiny8
import pytest from tiny8.cpu import SREG_C, SREG_Z class TestCALL: def test_nested_calls(self, cpu_with_program, helper): """Test nested subroutine calls.""" cpu = cpu_with_program(""" ldi r0, 5 call double jmp done double: call add_self ...
10)
assert_*
numeric_literal
tests/test_control_flow.py
test_nested_calls
TestCALL
244
null
sql-hkr/tiny8
import pytest from tiny8.memory import Memory class TestMemoryBasicOperations: def test_load_rom_preserves_mask(self): """Test that load_rom preserves 8-bit mask.""" mem = Memory(rom_size=10) mem.load_rom([256, 257, 258]) assert mem.read_rom(0) == 0 # 256 & 0xFF assert m...
1
assert
numeric_literal
tests/test_memory.py
test_load_rom_preserves_mask
TestMemoryBasicOperations
50
null
sql-hkr/tiny8
import pytest from tiny8 import assemble from tiny8.cpu import SREG_C, SREG_H, SREG_N, SREG_S, SREG_V, SREG_Z class TestADD: def test_add_zero_flag(self, cpu_with_program, helper): """Test zero flag with result of zero.""" cpu = cpu_with_program(""" ldi r0, 0x00 ldi r1, 0x...
0)
assert_*
numeric_literal
tests/test_arithmetic.py
test_add_zero_flag
TestADD
61
null
sql-hkr/tiny8
import time from tiny8.utils import ProgressBar class TestProgressBarFormatting: def test_progress_bar_format_time_short(self): """Test time formatting for short durations.""" pbar = ProgressBar(total=100, disable=True) assert pbar._format_time(65) == "01:05" assert pbar._format_...
"00:00"
assert
string_literal
tests/test_utils.py
test_progress_bar_format_time_short
TestProgressBarFormatting
107
null
sql-hkr/tiny8
import pytest from tiny8.memory import Memory class TestMemoryChangeTracking: def test_write_ram_change_tracking(self): """Test that RAM changes are tracked.""" mem = Memory(ram_size=10) mem.write_ram(5, 42, step=1) assert len(mem.ram_changes) == 1 assert mem.ram_changes[...
(5, 0, 42, 1)
assert
collection
tests/test_memory.py
test_write_ram_change_tracking
TestMemoryChangeTracking
62
null
sql-hkr/tiny8
import time from tiny8.utils import ProgressBar class TestProgressBarMethods: def test_progress_bar_reset(self): """Test resetting progress bar.""" pbar = ProgressBar(total=100, disable=False, mininterval=0) pbar.update(50) pbar.reset() assert pbar.n ==
0
assert
numeric_literal
tests/test_utils.py
test_progress_bar_reset
TestProgressBarMethods
89
null
sql-hkr/tiny8
import pytest from tiny8 import assemble, assemble_file class TestAssemblerWithFiles: def test_assemble_file_with_actual_file(self, tmp_path): """Test assembling from actual file.""" asm_file = tmp_path / "test.asm" asm_file.write_text(""" ldi r16, 42 ldi r17, 100 ...
2
assert
numeric_literal
tests/test_assembler.py
test_assemble_file_with_actual_file
TestAssemblerWithFiles
93
null
sql-hkr/tiny8
import pytest from tiny8 import assemble, assemble_file class TestAssemblerBasics: def test_assemble_empty_string(self): """Test assembling empty string.""" result = assemble("") assert len(result.program) ==
0
assert
numeric_literal
tests/test_assembler.py
test_assemble_empty_string
TestAssemblerBasics
22
null
sql-hkr/tiny8
import pytest class TestLDI: @pytest.mark.parametrize( "reg,value", [(16, 0), (17, 1), (18, 127), (19, 128), (20, 255)] ) def test_ldi_parametrized(self, cpu_with_program, helper, reg, value): """Test LDI with various registers and values.""" cpu = cpu_with_program(f""" ...
value)
assert_*
variable
tests/test_data_transfer.py
test_ldi_parametrized
TestLDI
40
null
nbQA-dev/nbQA
import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING from nbqa.__main__ import main def test_mypy_works(capsys: "CaptureFixture") -> None: """ Check mypy works. Shouldn't alter the notebook content. Parameters ---------- capsys Pytest fixture to ...
result
assert
variable
tests/tools/test_mypy_works.py
test_mypy_works
44
null
nbQA-dev/nbQA
import os import pytest from _pytest.capture import CaptureFixture from _pytest.monkeypatch import MonkeyPatch from nbqa.__main__ import main @pytest.mark.skip(reason="too slow - TODO how to re-enable / speedup?") def test_hash_collision(monkeypatch: MonkeyPatch, capsys: CaptureFixture) -> None: """Check hash co...
err
assert
variable
tests/test_hash_collision.py
test_hash_collision
19
null
nbQA-dev/nbQA
from textwrap import dedent from nbqa.output_parser import map_python_line_to_nb_lines def test_map_python_line_to_nb_lines() -> None: """Check that the output is correctly parsed if there is a warning about line 0.""" out = "notebook.ipynb:0:1: WPS102 Found incorrect module name pattern" err = "" not...
expected
assert
variable
tests/test_map_python_line_to_nb_lines.py
test_map_python_line_to_nb_lines
16
null
nbQA-dev/nbQA
import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING from nbqa.__main__ import main def test_mypy_with_local_import(capsys: "CaptureFixture") -> None: """ Check mypy can find local import. Parameters ---------- capsys Pytest fixture to capture st...
out
assert
variable
tests/tools/test_mypy_works.py
test_mypy_with_local_import
67
null
nbQA-dev/nbQA
import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING from nbqa.__main__ import main def test_pyproject_toml_works(capsys: "CaptureFixture") -> None: """ Check if config is picked up from pyproject.toml works. Parameters ---------- capsys Pytest f...
expected_out
assert
variable
tests/test_pyproject_toml.py
test_pyproject_toml_works
39
null
nbQA-dev/nbQA
import os import warnings from pathlib import Path from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main def test_myst(tmp_test_data: Path) -> None: """ Test notebook in myst format. Parameters ---------- tmp_test_data Temporary copy of test data. """ note...
expected
assert
variable
tests/test_jupytext.py
test_myst
127
null
nbQA-dev/nbQA
import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main @pytest.mark.parametrize( "path_0, path_1, path_2", ( ( os.path.abspath( os.path.join("tests", "data", "notebook_for_testing.ipynb")...
sorted(expected_err.splitlines())
assert
func_call
tests/tools/test_flake8_works.py
test_flake8_works
75
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING from nbqa.__main__ import main def test_pydocstyle_works(capsys: "CaptureFixture") -> None: """ Check pydocstyle works. Parameters ---------- capsys Pytest fixture to capture stdout and stderr. """ path = os.path.join("tests", "data", "no...
""
assert
string_literal
tests/tools/test_pydocstyle.py
test_pydocstyle_works
35
null
nbQA-dev/nbQA
import os from pathlib import Path from typing import TYPE_CHECKING from nbqa.__main__ import main SPARKLES = "\N{SPARKLES}" SHORTCAKE = "\N{SHORTCAKE}" COLLISION = "\N{COLLISION SYMBOL}" BROKEN_HEART = "\N{BROKEN HEART}" TESTS_DIR = Path("tests") TEST_DATA_DIR = TESTS_DIR / "data" DIRTY_NOTEBOOK = TEST_DATA_DIR / "...
err
assert
variable
tests/test_nbqa_diff.py
test_diff_present
42
null
nbQA-dev/nbQA
import difflib import os from pathlib import Path from typing import TYPE_CHECKING from nbqa.__main__ import main def test_mdformat_works_with_empty_file(capsys: "CaptureFixture") -> None: """ Check mdformat works with empty notebook. Parameters ---------- capsys Pytest fixture to capture...
"Notebook(s) would be left unchanged\n"
assert
string_literal
tests/tools/test_mdformat.py
test_mdformat_works_with_empty_file
46
null
nbQA-dev/nbQA
import os import re import subprocess import sys from pathlib import Path from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main @pytest.mark.usefixtures("tmp_remove_all") def test_remove_all_no_trailing_sc(capsys: "CaptureFixture") -> None: """Check error message shows if we're unable to ...
""
assert
string_literal
tests/test_runtime_errors.py
test_remove_all_no_trailing_sc
96
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING from nbqa.__main__ import main def test_non_python_notebook(capsys: "CaptureFixture") -> None: """ Should ignore non-Python notebook. Parameters ---------- capsys Pytest fixture to capture stdout and stderr. """ path = os.path.join("tests...
0
assert
numeric_literal
tests/test_non_python_notebook.py
test_non_python_notebook
26
null
nbQA-dev/nbQA
import os import re import subprocess import sys from pathlib import Path from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main def test_unable_to_reconstruct_message_pythonpath(monkeypatch: "MonkeyPatch") -> None: """ Same as ``test_unable_to_reconstruct_message`` but we check ``PYTH...
output.stderr
assert
complex_expr
tests/test_runtime_errors.py
test_unable_to_reconstruct_message_pythonpath
152
null
nbQA-dev/nbQA
import os import sys from pathlib import Path from shutil import copyfile from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main @pytest.mark.skipif( sys.version_info >= (3, 11), reason="Some deprecation warning shows up" ) def test_successive_runs_using_autopep8( tmpdir: "LocalPath", ...
"Notebook(s) would be left unchanged\n"
assert
string_literal
tests/tools/test_autopep8.py
test_successive_runs_using_autopep8
73
null
nbQA-dev/nbQA
import difflib import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING from nbqa.__main__ import main def test_pyupgrade_works_with_empty_file(capsys: "CaptureFixture") -> None: """ Check pyupgrade works with empty notebook. Parameters ---------- capsys ...
""
assert
string_literal
tests/tools/test_pyupgrade.py
test_pyupgrade_works_with_empty_file
73
null
nbQA-dev/nbQA
import difflib import json import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING import pytest from nbqa.__main__ import UnsupportedPackageVersionError, main def test_old_isort(monkeypatch: "MonkeyPatch") -> None: """ Check that using an old version of isort will rai...
str(excinfo.value)
assert
func_call
tests/tools/test_isort_works.py
test_old_isort
198
null
nbQA-dev/nbQA
import os import re import subprocess import sys from pathlib import Path from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main @pytest.mark.usefixtures("tmp_remove_comments") def test_unable_to_reconstruct_message(capsys: "CaptureFixture") -> None: """Check error message shows if we're u...
err
assert
variable
tests/test_runtime_errors.py
test_unable_to_reconstruct_message
71
null
nbQA-dev/nbQA
import os from pathlib import Path from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main @pytest.mark.parametrize( "path_0, path_1, path_2", ( ( os.path.abspath( os.path.join("tests", "data", "notebook_for_testing.ipynb") ), ...
""
assert
string_literal
tests/tools/test_ruff_works.py
test_ruff_works
88
null
nbQA-dev/nbQA
import os import warnings from pathlib import Path from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main def test_non_jupytext_md() -> None: """Check non-Python markdown will be ignored.""" ret = main(["black", "README.md"]) assert ret ==
0
assert
numeric_literal
tests/test_jupytext.py
test_non_jupytext_md
204
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main def test_with_subcommand(capsys: "CaptureFixture") -> None: """Check subcommand is picked up by module.""" main(["tests.local_script foo", "."]) out, _ = capsys.readouterr() assert out.replace("\r\n", "\n") ==
"['foo']\n"
assert
string_literal
tests/test_local_script.py
test_with_subcommand
59
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING from nbqa.__main__ import main def test_blacken_docs(capsys: "CaptureFixture") -> None: """ Check blacken-docs. Parameters ---------- capsys Pytest fixture to capture stdout and stderr. """ path = os.path.join("tests", "data", "notebook_f...
expected_err
assert
variable
tests/tools/test_blacken_docs.py
test_blacken_docs
49
null
nbQA-dev/nbQA
import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main @pytest.mark.parametrize( "path_0, path_1, path_2", ( ( os.path.abspath( os.path.join("tests", "data", "notebook_for_testing.ipynb")...
sorted(expected_out.splitlines())
assert
func_call
tests/tools/test_flake8_works.py
test_flake8_works
74
null
nbQA-dev/nbQA
import difflib import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING from nbqa.__main__ import main def test_pyupgrade(tmp_notebook_for_testing: Path, capsys: "CaptureFixture") -> None: """ Check pyupgrade works. Should only reformat code cells. Parameters --...
expected_err
assert
variable
tests/tools/test_pyupgrade.py
test_pyupgrade
56
null
nbQA-dev/nbQA
import difflib import json import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING import pytest from nbqa.__main__ import UnsupportedPackageVersionError, main def test_return_code_false_positive() -> None: """ Check return code is 0 when running with ``--lines-after-i...
0
assert
numeric_literal
tests/tools/test_isort_works.py
test_return_code_false_positive
236
null
nbQA-dev/nbQA
from pathlib import Path from typing import Sequence import pytest from nbqa.find_root import find_project_root @pytest.mark.parametrize( "src", [ (Path.cwd(),), (Path.cwd() / "tests", Path.cwd() / "tests/data"), ], ) def test_find_project_root(src: Sequence[str]) -> None: """ Che...
expected
assert
variable
tests/test_find_root.py
test_find_project_root
29
null
nbQA-dev/nbQA
import difflib import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING from nbqa.__main__ import main def test_pyupgrade(tmp_notebook_for_testing: Path, capsys: "CaptureFixture") -> None: """ Check pyupgrade works. Should only reformat code cells. Parameters --...
expected
assert
variable
tests/tools/test_pyupgrade.py
test_pyupgrade
49
null
nbQA-dev/nbQA
import os from pathlib import Path from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main def test_ruff_format(capsys: "CaptureFixture", tmp_notebook_for_testing: Path) -> None: """ Should ignore cell with all magics. Parameters ---------- capsys Pytest fixture to ...
"1 file reformatted\n"
assert
string_literal
tests/tools/test_ruff_works.py
test_ruff_format
140
null
nbQA-dev/nbQA
import os import sys from typing import TYPE_CHECKING from nbqa.__main__ import main GOOD_EXAMPLE_NOTEBOOK = os.path.join("tests", "data", "notebook_for_testing.ipynb") WRONG_EXAMPLE_NOTEBOOK = os.path.join( "tests", "data", "notebook_for_testing_copy.ipynb" ) INVALID_IMPORT_NOTEBOOK = os.path.join( "tests", ...
""
assert
string_literal
tests/tools/test_doctest.py
test_doctest_works
33
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING from nbqa.__main__ import main def test_blacken_docs(capsys: "CaptureFixture") -> None: """ Check blacken-docs. Parameters ---------- capsys Pytest fixture to capture stdout and stderr. """ path = os.path.join("tests", "data", "notebook_f...
expected_out
assert
variable
tests/tools/test_blacken_docs.py
test_blacken_docs
48
null
nbQA-dev/nbQA
import subprocess from functools import partial from pathlib import Path from typing import Sequence TESTS_DIR = Path("tests") TEST_DATA_DIR = TESTS_DIR / "data" DIRTY_NOTEBOOK = TEST_DATA_DIR / "notebook_for_testing.ipynb" CLEAN_NOTEBOOK = TEST_DATA_DIR / "clean_notebook.ipynb" EMPTY_NOTEBOOK = TEST_DATA_DIR / "empty...
PASSED
assert
variable
tests/test_return_code.py
test_flake8_return_code
30
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING from nbqa.__main__ import main def test_non_python_notebook(capsys: "CaptureFixture") -> None: """ Should ignore non-Python notebook. Parameters ---------- capsys Pytest fixture to capture stdout and stderr. """ path = os.path.join("tests...
""
assert
string_literal
tests/test_non_python_notebook.py
test_non_python_notebook
24
null
nbQA-dev/nbQA
import os from pathlib import Path from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main @pytest.mark.parametrize( "path_0, path_1, path_2", ( ( os.path.abspath( os.path.join("tests", "data", "notebook_for_testing.ipynb") ), ...
exp
assert
variable
tests/tools/test_ruff_works.py
test_ruff_works
87
null
nbQA-dev/nbQA
import os import re import subprocess import sys from pathlib import Path from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main @pytest.mark.usefixtures("tmp_remove_all") def test_remove_all_no_trailing_sc(capsys: "CaptureFixture") -> None: """Check error message shows if we're unable to ...
expected_out
assert
variable
tests/test_runtime_errors.py
test_remove_all_no_trailing_sc
95
null
nbQA-dev/nbQA
import difflib import json import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING import pytest from nbqa.__main__ import UnsupportedPackageVersionError, main def test_old_isort(monkeypatch: "MonkeyPatch") -> None: """ Check that using an old version of isort will rai...
UnsupportedPackageVersionError)
pytest.raises
variable
tests/tools/test_isort_works.py
test_old_isort
194
null
nbQA-dev/nbQA
from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING from nbqa.__main__ import main def test_configs_work(capsys: "CaptureFixture") -> None: """ Check a flake8 cfg file is picked up by nbqa. Parameters ---------- capsys Pytest fixture to capture stdout and...
expected_out
assert
variable
tests/test_configs_work.py
test_configs_work
39
null
nbQA-dev/nbQA
import os import re import subprocess import sys from pathlib import Path from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main def test_missing_root_dir(capsys: "CaptureFixture") -> None: """Check useful error message is raised if :code:`nbqa` is called without root_dir.""" prefix = ...
SystemExit)
pytest.raises
variable
tests/test_runtime_errors.py
test_missing_root_dir
59
null
nbQA-dev/nbQA
import difflib import operator import os import subprocess from pathlib import Path from shutil import copyfile from textwrap import dedent from typing import TYPE_CHECKING, Callable from nbqa.__main__ import main SPARKLES = "\N{SPARKLES}" SHORTCAKE = "\N{SHORTCAKE}" COLLISION = "\N{COLLISION SYMBOL}" BROKEN_HEART = ...
out
assert
variable
tests/tools/test_black.py
test_black_works_with_commented_magics
217
null
nbQA-dev/nbQA
import difflib import json import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING import pytest from nbqa.__main__ import UnsupportedPackageVersionError, main def test_return_code_false_positive() -> None: """ Check return code is 0 when running with ``--lines-after-i...
1
assert
numeric_literal
tests/tools/test_isort_works.py
test_return_code_false_positive
239
null
nbQA-dev/nbQA
import difflib import operator import os import subprocess from pathlib import Path from shutil import copyfile from textwrap import dedent from typing import TYPE_CHECKING, Callable from nbqa.__main__ import main SPARKLES = "\N{SPARKLES}" SHORTCAKE = "\N{SHORTCAKE}" COLLISION = "\N{COLLISION SYMBOL}" BROKEN_HEART = ...
""
assert
string_literal
tests/tools/test_black.py
test_black_multiple_files
167
null
nbQA-dev/nbQA
import difflib import os from pathlib import Path from typing import TYPE_CHECKING from nbqa.__main__ import main def test_mdformat(tmp_notebook_for_testing: Path) -> None: """Check mdformat works""" with open(tmp_notebook_for_testing, encoding="utf-8") as handle: before = handle.readlines() path ...
expected
assert
variable
tests/tools/test_mdformat.py
test_mdformat
29
null
nbQA-dev/nbQA
import os import warnings from pathlib import Path from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main def test_jupytext_on_folder(capsys: "CaptureFixture") -> None: """Check invalid files aren't checked.""" path = os.path.join("tests", "invalid_data") main( [ ...
"\n".join( sorted(expected.splitlines()) )
assert
string_literal
tests/test_jupytext.py
test_jupytext_on_folder
306
null
nbQA-dev/nbQA
import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING from nbqa.__main__ import main def test_mypy_works(capsys: "CaptureFixture") -> None: """ Check mypy works. Shouldn't alter the notebook content. Parameters ---------- capsys Pytest fixture to ...
""
assert
string_literal
tests/tools/test_mypy_works.py
test_mypy_works
45
null
nbQA-dev/nbQA
import os import sys from shutil import which from subprocess import CompletedProcess from typing import List import pytest from _pytest.capture import CaptureFixture from _pytest.monkeypatch import MonkeyPatch from nbqa.__main__ import CommandNotFoundError, main def _message(args: List[str]) -> str: return f"I ...
"tests/data/notebook_for_autoflake.ipynb:import pandas as pd\n"
assert
string_literal
tests/test_nbqa_shell.py
test_grep
72
null
nbQA-dev/nbQA
import difflib import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING from nbqa.__main__ import main def test_pyupgrade(tmp_notebook_for_testing: Path, capsys: "CaptureFixture") -> None: """ Check pyupgrade works. Should only reformat code cells. Parameters --...
expected_out
assert
variable
tests/tools/test_pyupgrade.py
test_pyupgrade
55
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING from nbqa.__main__ import main def test_pylint_works(capsys: "CaptureFixture") -> None: """ Check pylint works. Check all the warnings raised by pylint on the notebook. Parameters ---------- capsys Pytest fixture to capture stdout and stderr. ...
expected_out.split(horizontal_bar, maxsplit=1)[0]
assert
func_call
tests/tools/test_pylint_works.py
test_pylint_works
55
null
nbQA-dev/nbQA
import os import sys from shutil import which from subprocess import CompletedProcess from typing import List import pytest from _pytest.capture import CaptureFixture from _pytest.monkeypatch import MonkeyPatch from nbqa.__main__ import CommandNotFoundError, main def _message(args: List[str]) -> str: return f"I ...
""
assert
string_literal
tests/test_nbqa_shell.py
test_nbqa_shell
38
null
nbQA-dev/nbQA
import difflib import json import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING import pytest from nbqa.__main__ import UnsupportedPackageVersionError, main def test_old_isort_separated_imports(tmp_test_data: Path) -> None: """ Check isort works when a notebook has ...
before_mtime
assert
variable
tests/tools/test_isort_works.py
test_old_isort_separated_imports
176
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main def test_local_nonfound() -> None: """Test local module is picked up.""" cwd = os.getcwd() os.chdir(os.path.join("tests", "invalid_data")) try: with pytest.raises(
ModuleNotFoundError)
pytest.raises
variable
tests/test_local_script.py
test_local_nonfound
49
null
nbQA-dev/nbQA
import difflib import json import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING import pytest from nbqa.__main__ import UnsupportedPackageVersionError, main def test_isort_works(tmp_notebook_for_testing: Path, capsys: "CaptureFixture") -> None: """ Check isort works...
expected_err
assert
variable
tests/tools/test_isort_works.py
test_isort_works
53
null
nbQA-dev/nbQA
import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main def test_cell_with_all_magics(capsys: "CaptureFixture") -> None: """ Should ignore cell with all magics. Parameters ---------- capsys Pytest fixtur...
""
assert
string_literal
tests/tools/test_flake8_works.py
test_cell_with_all_magics
91
null
nbQA-dev/nbQA
from typing import TYPE_CHECKING from nbqa.__main__ import main def test_file_not_found(capsys: "CaptureFixture") -> None: """Check useful error message is raised if file or directory doesn't exist.""" msg = "No such file or directory: i_dont_exist.ipynb" main(["isort", "i_dont_exist.ipynb", "--profile=b...
err
assert
variable
tests/test_file_not_found.py
test_file_not_found
17
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING from nbqa.__main__ import main def test_cmdline(capsys: "CaptureFixture") -> None: """Check running from command-line.""" file = os.path.join("tests", "invalid_data", "automagic.ipynb") main(["black", file, "--nbqa-diff"]) out, _ = capsys.readouterr() exp...
expected_out
assert
variable
tests/test_skip_bad_cells.py
test_cmdline
28
null
nbQA-dev/nbQA
import os import sys from shutil import which from subprocess import CompletedProcess from typing import List import pytest from _pytest.capture import CaptureFixture from _pytest.monkeypatch import MonkeyPatch from nbqa.__main__ import CommandNotFoundError, main def _message(args: List[str]) -> str: return f"I ...
CommandNotFoundError, match=msg)
pytest.raises
complex_expr
tests/test_nbqa_shell.py
test_nbqa_shell_not_found
63
null
nbQA-dev/nbQA
import difflib import json import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING import pytest from nbqa.__main__ import UnsupportedPackageVersionError, main def test_isort_works(tmp_notebook_for_testing: Path, capsys: "CaptureFixture") -> None: """ Check isort works...
expected
assert
variable
tests/tools/test_isort_works.py
test_isort_works
46
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING from nbqa.__main__ import main def test_deprecated(capsys: "CaptureFixture") -> None: """Test deprecation errors.""" path = os.path.join("tests", "data", "clean_notebook.ipynb") main(["flake8", path, "--nbqa-skip-bad-cells"]) _, err = capsys.readouterr() ...
"Flag --nbqa-skip-bad-cells was deprecated in 0.13.0\n" "Cells with invalid syntax are now skipped by default\n"
assert
string_literal
tests/test_deprecated.py
test_deprecated
17
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING from nbqa.__main__ import main def test_non_python_notebook(capsys: "CaptureFixture") -> None: """ Should ignore non-Python notebook. Parameters ---------- capsys Pytest fixture to capture stdout and stderr. """ path = os.path.join("tests...
"No valid Python notebooks found in given path(s)\n"
assert
string_literal
tests/test_non_python_notebook.py
test_non_python_notebook
25
null
nbQA-dev/nbQA
import os from pathlib import Path from typing import TYPE_CHECKING from nbqa.__main__ import main SPARKLES = "\N{SPARKLES}" SHORTCAKE = "\N{SHORTCAKE}" COLLISION = "\N{COLLISION SYMBOL}" BROKEN_HEART = "\N{BROKEN HEART}" TESTS_DIR = Path("tests") TEST_DATA_DIR = TESTS_DIR / "data" DIRTY_NOTEBOOK = TEST_DATA_DIR / "...
expected_out
assert
variable
tests/test_nbqa_diff.py
test_diff_present
41
null
nbQA-dev/nbQA
import os import sys from pathlib import Path from shutil import copyfile from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main @pytest.mark.skipif( sys.version_info >= (3, 11), reason="Some deprecation warning shows up" ) def test_successive_runs_using_autopep8( tmpdir: "LocalPath", ...
""
assert
string_literal
tests/tools/test_autopep8.py
test_successive_runs_using_autopep8
74
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING from nbqa.__main__ import main def test_skip_celltags_cli(capsys: "CaptureFixture") -> None: """ Check flake8 works. Shouldn't alter the notebook content. Parameters ---------- capsys Pytest fixture to capture stdout and stderr. """ # che...
expected_err
assert
variable
tests/test_skip_celltags.py
test_skip_celltags_cli
31
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING from nbqa.__main__ import main def test_pydocstyle_works(capsys: "CaptureFixture") -> None: """ Check pydocstyle works. Parameters ---------- capsys Pytest fixture to capture stdout and stderr. """ path = os.path.join("tests", "data", "no...
expected_out
assert
variable
tests/tools/test_pydocstyle.py
test_pydocstyle_works
34
null
nbQA-dev/nbQA
import os from pathlib import Path from shutil import copyfile from typing import TYPE_CHECKING from nbqa.__main__ import main def test_successive_runs_using_yapf( tmpdir: "LocalPath", capsys: "CaptureFixture" ) -> None: """Check yapf returns 0 on the second run given a dirty notebook.""" src_notebook = P...
expected_out
assert
variable
tests/tools/test_yapf.py
test_successive_runs_using_yapf
48
null
nbQA-dev/nbQA
import difflib import operator import os import subprocess from pathlib import Path from shutil import copyfile from textwrap import dedent from typing import TYPE_CHECKING, Callable from nbqa.__main__ import main SPARKLES = "\N{SPARKLES}" SHORTCAKE = "\N{SHORTCAKE}" COLLISION = "\N{COLLISION SYMBOL}" BROKEN_HEART = ...
expected
assert
variable
tests/tools/test_black.py
test_black_works
52
null
nbQA-dev/nbQA
import os from typing import TYPE_CHECKING from nbqa.__main__ import main def test_skip_celltags_cli(capsys: "CaptureFixture") -> None: """ Check flake8 works. Shouldn't alter the notebook content. Parameters ---------- capsys Pytest fixture to capture stdout and stderr. """ # che...
expected_out
assert
variable
tests/test_skip_celltags.py
test_skip_celltags_cli
30
null
nbQA-dev/nbQA
import subprocess from nbqa import __version__ def test_version() -> None: """Check you can run :code:`nbqa --version`.""" output = subprocess.run(["nbqa", "--version"], capture_output=True, text=True) assert output.stdout.strip() ==
f"nbqa {__version__}"
assert
string_literal
tests/test_version.py
test_version
11
null
nbQA-dev/nbQA
import os from pathlib import Path from textwrap import dedent from typing import TYPE_CHECKING import pytest from nbqa.__main__ import main @pytest.mark.parametrize( "arg, cwd", [ (Path("tests"), Path.cwd()), (Path("data"), Path.cwd() / "tests"), (Path("notebook_for_testing.ipynb"), ...
out
assert
variable
tests/test_running_from_different_dir.py
test_running_in_different_dir_works
51
null
openatx/uiautomator2
import os import cv2 import numpy as np import pytest from PIL import Image import uiautomator2.image as u2image TESTDIR = os.path.dirname(os.path.abspath(__file__)) + "/testdata" # if set to DIR__, pytest will fail with TypeError: 'str' object is not callable def path_ae86(): filepath = os.path.join(TESTDIR, "...
409
assert
numeric_literal
mobile_tests/skip_test_image.py
test_image_match
72
null
openatx/uiautomator2
import hashlib from unittest.mock import Mock, mock_open, patch import pytest from uiautomator2.core import BasicUiautomatorServer def mock_server(): """Create a mock BasicUiautomatorServer instance with a mock device""" mock_dev = Mock() with patch.object(BasicUiautomatorServer, '__init__', return_value...
["md5", "/data/local/tmp/u2.jar"]
assert
collection
tests/test_core.py
test_toybox_not_found_fallback_to_md5
TestCheckDeviceFileHash
71
null
openatx/uiautomator2
import os import cv2 import numpy as np import pytest from PIL import Image import uiautomator2.image as u2image TESTDIR = os.path.dirname(os.path.abspath(__file__)) + "/testdata" # if set to DIR__, pytest will fail with TypeError: 'str' object is not callable def path_ae86(): filepath = os.path.join(TESTDIR, "...
(321, 193)
assert
collection
mobile_tests/skip_test_image.py
test_imread
45
null
openatx/uiautomator2
import threading import time import pytest from PIL import Image from uiautomator2 import utils def test_inject_call(): def foo(a, b, c=2): return a*100+b*10+c ret = utils.inject_call(foo, a=2, b=4) assert ret == 242 with pytest.raises(
TypeError)
pytest.raises
variable
tests/test_utils.py
test_inject_call
32
null
openatx/uiautomator2
import random from pathlib import Path import pytest from PIL import Image import uiautomator2 as u2 def test_push_pull(d: u2.Device, tmp_path: Path): src_file = tmp_path / "test_push.txt" src_file.write_text("12345") d.push(src_file, "/data/local/tmp/test_push.txt") dst_file = tmp_path / "test_...
"12345"
assert
string_literal
demo_tests/test_device.py
test_push_pull
133
null
openatx/uiautomator2
import time import unittest import pytest import uiautomator2 as u2 @pytest.mark.skip("not working") def test_toast_get_message(dev: u2.Device): d = dev assert d.toast.get_message(0) is None assert d.toast.get_message(0, default="d") ==
"d"
assert
string_literal
mobile_tests/test_simple.py
test_toast_get_message
18
null
openatx/uiautomator2
import random from pathlib import Path import pytest from PIL import Image import uiautomator2 as u2 def test_toast(app: u2.Device): app.clear_toast() assert app.last_toast is
None
assert
none_literal
demo_tests/test_device.py
test_toast
108
null
openatx/uiautomator2
import time import unittest import pytest import uiautomator2 as u2 @pytest.mark.skip("Deprecated") def test_plugin(self): def _my_plugin(d, k): def _inner(): return k return _inner u2.plugin_clear() u2.plugin_register('my', _my_plugin, 'pp') self.assertEqual(self.d.ext...
'pp')
self.assertEqual
string_literal
mobile_tests/test_simple.py
test_plugin
137
null
openatx/uiautomator2
import threading import time import pytest from PIL import Image from uiautomator2 import utils def test_naturalsize(): assert utils.natualsize(1) == "0.0 KB" assert utils.natualsize(1024) == "1.0 KB" assert utils.natualsize(1<<20) == "1.0 MB" assert utils.natualsize(1<<30) ==
"1.0 GB"
assert
string_literal
tests/test_utils.py
test_naturalsize
73
null
openatx/uiautomator2
import time import unittest import pytest import uiautomator2 as u2 @pytest.mark.skip("not working") def test_toast_get_message(dev: u2.Device): d = dev assert d.toast.get_message(0) is None assert d.toast.get_message(0, default="d") == "d" d(text="App").click() d(text="Notification").click() ...
d.toast.get_message(2, 5, "")
assert
func_call
mobile_tests/test_simple.py
test_toast_get_message
27
null
openatx/uiautomator2
import threading import time import pytest from PIL import Image from uiautomator2 import utils def test_with_package_resource(): with utils.with_package_resource("assets/sync.sh") as asset_path: assert asset_path.exists() assert asset_path.is_file() assert asset_path.name == "sync.sh" ...
FileNotFoundError)
pytest.raises
variable
tests/test_utils.py
test_with_package_resource
101
null
openatx/uiautomator2
import threading from functools import partial import pytest import uiautomator2 as u2 def test_get_text(dev: u2.Device): assert dev.xpath("App").get_text() ==
"App"
assert
string_literal
mobile_tests/test_xpath.py
test_get_text
13
null
openatx/uiautomator2
from unittest.mock import Mock, patch import pytest from uiautomator2._input import InputMethodMixIn from uiautomator2.exceptions import AdbBroadcastError def test_hide_keyboard_method(): """Test the hide_keyboard method directly""" mock_input = MockInputMethodMixIn() mock_input.hide_keyboard() ...
1
assert
numeric_literal
tests/test_input.py
test_hide_keyboard_method
110
null