repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_cups.py | test_read_no_device | assert | collection | 18 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_read_no_device(cupsprinter):
"""
GIVEN a cups printer object
WHEN device is None
THEN check the return value is []
"""
cupspri... | [] | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_cups.py | test_open_not_raise_exception | assert | none_literal | 23 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_open_not_raise_exception(cupsprinter, caplog):
"""
GIVEN a cups printer object
WHEN open() is set to not raise on error but simply cancel
... | None | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_cups.py | test_device_not_initialized | assert | bool_literal | 17 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_device_not_initialized(cupsprinter):
"""
GIVEN a cups printer object
WHEN it is not initialized
THEN check the device property is Fals... | False | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_cups.py | test_raw | assert | string_literal | 19 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_raw(cupsprinter):
"""
GIVEN a cups printer object
WHEN passing a byte string to _raw()
THEN check the buffer content
"""
cupsp... | b"Test" | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_cups.py | test_raw_raise_exception | pytest.raises | variable | 17 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_raw_raise_exception(cupsprinter):
"""
GIVEN a cups printer object
WHEN passing a non byte string to _raw()
THEN check an exception is ... | TypeError) | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_cups.py | test_open_not_raise_exception | assert | complex_expr | 22 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_open_not_raise_exception(cupsprinter, caplog):
"""
GIVEN a cups printer object
WHEN open() is set to not raise on error but simply cancel
... | caplog.text | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_cups.py | test_open | assert | complex_expr | 21 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_open(cupsprinter, caplog, mocker):
"""
GIVEN a cups printer object and a mocked pycups device
WHEN a valid connection to a device is opene... | cupsprinter.printers | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_cups.py | test_open_raise_exception | pytest.raises | variable | 19 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_open_raise_exception(cupsprinter, devicenotfounderror):
"""
GIVEN a cups printer object
WHEN open() is set to raise a DeviceNotFoundError ... | devicenotfounderror) | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_file.py | test_flush | assert | numeric_literal | 20 | import logging
import pytest
def test_flush(fileprinter, mocker):
"""
GIVEN a file printer object and a mocked connection
WHEN auto_flush is disabled and flush() issued manually
THEN check the flush method is called only one time.
"""
spy = mocker.spy(fileprinter, "flush")
mocker.patch("bu... | 1 | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_file.py | test_open_not_raise_exception | assert | none_literal | 18 | import logging
import pytest
def test_open_not_raise_exception(fileprinter, caplog):
"""
GIVEN a file printer object
WHEN open() is set to not raise on error but simply cancel
THEN check the error is logged and open() canceled
"""
fileprinter.devfile = "fake/device"
with caplog.at_level(l... | None | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_file.py | test_device_not_initialized | assert | bool_literal | 12 | import logging
import pytest
def test_device_not_initialized(fileprinter):
"""
GIVEN a file printer object
WHEN it is not initialized
THEN check the device property is False
"""
assert fileprinter._device is | False | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_file.py | test_open_not_raise_exception | assert | complex_expr | 17 | import logging
import pytest
def test_open_not_raise_exception(fileprinter, caplog):
"""
GIVEN a file printer object
WHEN open() is set to not raise on error but simply cancel
THEN check the error is logged and open() canceled
"""
fileprinter.devfile = "fake/device"
with caplog.at_level(l... | caplog.text | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_file.py | test_open_raise_exception | pytest.raises | variable | 14 | import logging
import pytest
def test_open_raise_exception(fileprinter, devicenotfounderror):
"""
GIVEN a file printer object
WHEN open() is set to raise a DeviceNotFoundError on error
THEN check the exception is raised
"""
fileprinter.devfile = "fake/device"
with pytest.raises( | devicenotfounderror) | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_lp.py | test_flush | assert | numeric_literal | 27 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_flush(lpprinter, mocker):
"""
GIVEN a lp printer object and a mocked connection
WHEN auto_flush is disabled and flush() issued manually
... | 1 | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_lp.py | test_open_not_raise_exception | assert | none_literal | 25 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_open_not_raise_exception(lpprinter, caplog, mocker):
"""
GIVEN a lp printer object
WHEN open() is set to not raise on error but simply can... | None | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_lp.py | test_device_not_initialized | assert | bool_literal | 17 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_device_not_initialized(lpprinter):
"""
GIVEN a lp printer object
WHEN it is not initialized
THEN check the device property is False
... | False | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_lp.py | test_open_not_raise_exception | assert | complex_expr | 24 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_open_not_raise_exception(lpprinter, caplog, mocker):
"""
GIVEN a lp printer object
WHEN open() is set to not raise on error but simply can... | caplog.text | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_lp.py | test_open | assert | complex_expr | 21 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_open(lpprinter, caplog, mocker):
"""
GIVEN a lp printer object and a mocked connection
WHEN a valid connection to a device is opened
T... | lpprinter.printers | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_lp.py | test_open_raise_exception | pytest.raises | variable | 21 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform == "win32", reason="skipping non Windows platform specific tests"
)
def test_open_raise_exception(lpprinter, devicenotfounderror, mocker):
"""
GIVEN a lp printer object
WHEN open() is set to raise a DeviceNotFoundEr... | devicenotfounderror) | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_network.py | test_open_not_raise_exception | assert | none_literal | 18 | import logging
import pytest
def test_open_not_raise_exception(networkprinter, caplog):
"""
GIVEN a network printer object
WHEN open() is set to not raise on error but simply cancel
THEN check the error is logged and open() canceled
"""
networkprinter.host = "fakehost"
with caplog.at_leve... | None | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_network.py | test_device_not_initialized | assert | bool_literal | 12 | import logging
import pytest
def test_device_not_initialized(networkprinter):
"""
GIVEN a network printer object
WHEN it is not initialized
THEN check the device property is False
"""
assert networkprinter._device is | False | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_network.py | test_open_not_raise_exception | assert | complex_expr | 17 | import logging
import pytest
def test_open_not_raise_exception(networkprinter, caplog):
"""
GIVEN a network printer object
WHEN open() is set to not raise on error but simply cancel
THEN check the error is logged and open() canceled
"""
networkprinter.host = "fakehost"
with caplog.at_leve... | caplog.text | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_network.py | test_open_raise_exception | pytest.raises | variable | 14 | import logging
import pytest
def test_open_raise_exception(networkprinter, devicenotfounderror):
"""
GIVEN a network printer object
WHEN open() is set to raise a DeviceNotFoundError on error
THEN check the exception is raised
"""
networkprinter.host = "fakehost"
with pytest.raises( | devicenotfounderror) | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_serial.py | test_open_not_raise_exception | assert | none_literal | 18 | import logging
import pytest
def test_open_not_raise_exception(serialprinter, caplog):
"""
GIVEN a serial printer object
WHEN open() is set to not raise on error but simply cancel
THEN check the error is logged and open() canceled
"""
serialprinter.devfile = "fake/device"
with caplog.at_l... | None | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_serial.py | test_device_not_initialized | assert | bool_literal | 12 | import logging
import pytest
def test_device_not_initialized(serialprinter):
"""
GIVEN a serial printer object
WHEN it is not initialized
THEN check the device property is False
"""
assert serialprinter._device is | False | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_serial.py | test_open_not_raise_exception | assert | complex_expr | 17 | import logging
import pytest
def test_open_not_raise_exception(serialprinter, caplog):
"""
GIVEN a serial printer object
WHEN open() is set to not raise on error but simply cancel
THEN check the error is logged and open() canceled
"""
serialprinter.devfile = "fake/device"
with caplog.at_l... | caplog.text | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_serial.py | test_open_raise_exception | pytest.raises | variable | 14 | import logging
import pytest
def test_open_raise_exception(serialprinter, devicenotfounderror):
"""
GIVEN a serial printer object
WHEN open() is set to raise a DeviceNotFoundError on error
THEN check the exception is raised
"""
serialprinter.devfile = "fake/device"
with pytest.raises( | devicenotfounderror) | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_usb.py | test_device_not_initialized | assert | bool_literal | 10 | import logging
def test_device_not_initialized(usbprinter):
"""
GIVEN a usb printer object
WHEN it is not initialized
THEN check the device property is False
"""
assert usbprinter._device is | False | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_usb.py | test_open | assert | complex_expr | 15 | import logging
def test_open(usbprinter, caplog, mocker):
"""
GIVEN a usb printer object and a mocked pyusb device
WHEN a valid connection to a device is opened
THEN check the success is logged and the device property is set
"""
mocker.patch("usb.core.find")
with caplog.at_level(logging.IN... | caplog.text | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_win32raw.py | test_open_not_raise_exception | assert | none_literal | 23 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform != "win32", reason="Skipping Windows platform specific tests"
)
def test_open_not_raise_exception(win32rawprinter, caplog):
"""
GIVEN a win32raw printer object
WHEN open() is set to not raise on error but simply can... | None | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_win32raw.py | test_device_not_initialized | assert | bool_literal | 17 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform != "win32", reason="Skipping Windows platform specific tests"
)
def test_device_not_initialized(win32rawprinter):
"""
GIVEN a win32raw printer object
WHEN it is not initialized
THEN check the device property is ... | False | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_win32raw.py | test_open_not_raise_exception | assert | complex_expr | 22 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform != "win32", reason="Skipping Windows platform specific tests"
)
def test_open_not_raise_exception(win32rawprinter, caplog):
"""
GIVEN a win32raw printer object
WHEN open() is set to not raise on error but simply can... | caplog.text | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_win32raw.py | test_raw | assert_* | string_literal | 25 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform != "win32", reason="Skipping Windows platform specific tests"
)
def test_raw(win32rawprinter, mocker):
"""
GIVEN a win32raw printer object and a mocked win32print device
WHEN calling _raw() after a valid connection
... | b"Test error") | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_win32raw.py | test_open_raise_exception | pytest.raises | variable | 19 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform != "win32", reason="Skipping Windows platform specific tests"
)
def test_open_raise_exception(win32rawprinter, devicenotfounderror):
"""
GIVEN a win32raw printer object
WHEN open() is set to raise a DeviceNotFoundEr... | devicenotfounderror) | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_win32raw.py | test_open | assert | complex_expr | 26 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform != "win32", reason="Skipping Windows platform specific tests"
)
def test_open(win32rawprinter, caplog, mocker):
"""
GIVEN a win32raw printer object and a mocked win32printer device
WHEN a valid connection to a devic... | win32rawprinter.printers | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_printers/test_printer_win32raw.py | test_open | assert | complex_expr | 34 | import logging
import sys
import pytest
pytestmark = pytest.mark.skipif(
sys.platform != "win32", reason="Skipping Windows platform specific tests"
)
def test_open(win32rawprinter, caplog, mocker):
"""
GIVEN a win32raw printer object and a mocked win32printer device
WHEN a valid connection to a devic... | PyPrinterHANDLE.return_value | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_profile.py | test_get_font | assert | numeric_literal | 14 | import pytest
from escpos.capabilities import BARCODE_B, NotSupported, Profile, get_profile
def profile():
return get_profile("default")
class TestBaseProfile:
def test_get_font(self, profile):
with pytest.raises(NotSupported):
assert profile.get_font("3")
assert profile.get_fon... | 1 | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_profile.py | test_get_font | assert | numeric_literal | 15 | import pytest
from escpos.capabilities import BARCODE_B, NotSupported, Profile, get_profile
def profile():
return get_profile("default")
class TestBaseProfile:
def test_get_font(self, profile):
with pytest.raises(NotSupported):
assert profile.get_font("3")
assert profile.get_font... | 0 | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_profile.py | test_get_columns | assert | numeric_literal | 12 | import pytest
from escpos.capabilities import BARCODE_B, NotSupported, Profile, get_profile
def profile():
return get_profile("default")
class TestBaseProfile:
def test_get_columns(self, profile):
assert profile.get_columns("a") > | 5 | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_profile.py | test_columns | assert | numeric_literal | 12 | import pytest
from escpos.capabilities import BARCODE_B, NotSupported, Profile, get_profile
def profile():
return get_profile("default")
class TestCustomProfile:
def test_columns(self):
assert Profile(columns=10).get_columns("sdfasdf") == | 10 | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_profile.py | test_get_font | pytest.raises | variable | 12 | import pytest
from escpos.capabilities import BARCODE_B, NotSupported, Profile, get_profile
def profile():
return get_profile("default")
class TestBaseProfile:
def test_get_font(self, profile):
with pytest.raises( | NotSupported) | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_raise_arbitrary_error.py | test_raise_error_wrongly | pytest.raises | variable | 12 | import pytest
import escpos
import escpos.exceptions
def test_raise_error_wrongly():
"""raise error the wrong way
should reproduce https://github.com/python-escpos/python-escpos/issues/257
"""
with pytest.raises( | AttributeError) | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-escpos/python-escpos | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | train | train | test/test_raise_arbitrary_error.py | tests_raise_error | pytest.raises | complex_expr | 9 | import pytest
import escpos
import escpos.exceptions
def tests_raise_error():
"""raise error the right way"""
with pytest.raises( | escpos.exceptions.Error) | 815f247df19055743515e19c40a03ab46ac0c72c | 27 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_cli.py | test_nonexistent_file_with_explicit_base_uri | self.assertIn | variable | 120 | from contextlib import redirect_stderr, redirect_stdout
from io import StringIO
from json import JSONDecodeError
from pathlib import Path
from textwrap import dedent
from unittest import TestCase
import errno
import json
import os
import subprocess
import sys
import tempfile
from pyrsistent import m
from jsonschema i... | error) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_cli.py | test_instance_is_invalid_JSON_pretty_output | self.assertFalse | variable | 114 | from contextlib import redirect_stderr, redirect_stdout
from io import StringIO
from json import JSONDecodeError
from pathlib import Path
from textwrap import dedent
from unittest import TestCase
import errno
import json
import os
import subprocess
import sys
import tempfile
from pyrsistent import m
from jsonschema i... | stdout) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_cli.py | test_instance_is_invalid_JSON_pretty_output | self.assertIn | variable | 115 | from contextlib import redirect_stderr, redirect_stdout
from io import StringIO
from json import JSONDecodeError
from pathlib import Path
from textwrap import dedent
from unittest import TestCase
import errno
import json
import os
import subprocess
import sys
import tempfile
from pyrsistent import m
from jsonschema i... | stderr) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_cli.py | test_license | self.assertIn | variable | 65 | from contextlib import redirect_stderr, redirect_stdout
from io import StringIO
from json import JSONDecodeError
from pathlib import Path
from textwrap import dedent
from unittest import TestCase
import errno
import json
import os
import subprocess
import sys
import tempfile
from pyrsistent import m
from jsonschema i... | output) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_cli.py | run_cli | self.assertEqual | variable | 79 | from contextlib import redirect_stderr, redirect_stdout
from io import StringIO
from json import JSONDecodeError
from pathlib import Path
from textwrap import dedent
from unittest import TestCase
import errno
import json
import os
import subprocess
import sys
import tempfile
from pyrsistent import m
from jsonschema i... | exit_code) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_cli.py | cli_output_for | self.assertRaises | variable | 66 | from contextlib import redirect_stderr, redirect_stdout
from io import StringIO
from json import JSONDecodeError
from pathlib import Path
from textwrap import dedent
from unittest import TestCase
import errno
import json
import os
import subprocess
import sys
import tempfile
from pyrsistent import m
from jsonschema i... | SystemExit) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_cli.py | test_invalid_schema_pretty_output | self.assertRaises | variable | 106 | from contextlib import redirect_stderr, redirect_stdout
from io import StringIO
from json import JSONDecodeError
from pathlib import Path
from textwrap import dedent
from unittest import TestCase
import errno
import json
import os
import subprocess
import sys
import tempfile
from pyrsistent import m
from jsonschema i... | SchemaError) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_deprecations.py | test_jsonschema_version | self.assertTrue | func_call | 13 | from unittest import TestCase
class TestDeprecations(TestCase):
def test_jsonschema_version(self):
"""
As of v4.0.0, __version__ is deprecated in favor of importlib.metadata.
"""
with self.assertWarns(DeprecationWarning) as w:
from jsonschema import __version__ # noqa
... | str(w.warning).startswith( "Accessing jsonschema.__version__ is deprecated", )) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_deprecations.py | test_jsonschema_validators_ErrorTree | self.assertTrue | func_call | 15 | from unittest import TestCase
class TestDeprecations(TestCase):
def test_jsonschema_validators_ErrorTree(self):
"""
As of v4.0.0, importing ErrorTree from jsonschema.validators is
deprecated in favor of doing so from jsonschema.exceptions.
"""
with self.assertWarns(Depreca... | str(w.warning).startswith( "Importing ErrorTree from jsonschema.validators is deprecated", )) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_exceptions.py | test_it_knows_how_many_total_errors_it_contains | self.assertEqual | numeric_literal | 15 | from unittest import TestCase
import textwrap
from jsonschema import Draft4Validator, exceptions
class TestErrorTree(TestCase):
def test_it_knows_how_many_total_errors_it_contains(self):
# FIXME: https://github.com/Julian/jsonschema/issues/442
errors = [
exceptions.ValidationError("Som... | 8) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_exceptions.py | test_it_calls_super_and_sets_args | self.assertGreater | numeric_literal | 29 | from unittest import TestCase
import textwrap
from jsonschema import Draft4Validator, exceptions
class TestErrorInitReprStr(TestCase):
def make_error(self, **kwargs):
defaults = dict(
message="hello",
validator="type",
validator_value="string",
instance=5,
... | 1) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_exceptions.py | test_it_contains_an_item_if_the_item_had_an_error | self.assertIn | variable | 12 | from unittest import TestCase
import textwrap
from jsonschema import Draft4Validator, exceptions
class TestErrorTree(TestCase):
def test_it_contains_an_item_if_the_item_had_an_error(self):
errors = [exceptions.ValidationError("a message", path=["bar"])]
tree = exceptions.ErrorTree(errors)
... | tree) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_exceptions.py | test_weak_validators_are_lower_priority | self.assertIs | variable | 16 | from unittest import TestCase
import textwrap
from jsonschema import Draft4Validator, exceptions
class TestByRelevance(TestCase):
def test_weak_validators_are_lower_priority(self):
weak = exceptions.ValidationError("Oh no!", path=[], validator="a")
normal = exceptions.ValidationError("Oh yes!", p... | normal) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_exceptions.py | test_strong_validators_are_higher_priority | self.assertIs | variable | 17 | from unittest import TestCase
import textwrap
from jsonschema import Draft4Validator, exceptions
class TestByRelevance(TestCase):
def test_strong_validators_are_higher_priority(self):
weak = exceptions.ValidationError("Oh no!", path=[], validator="a")
normal = exceptions.ValidationError("Oh yes!"... | strong) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_exceptions.py | test_if_the_most_relevant_error_is_anyOf_it_is_traversed | self.assertEqual | string_literal | 42 | from unittest import TestCase
import textwrap
from jsonschema import Draft4Validator, exceptions
class TestBestMatch(TestCase):
def best_match(self, errors):
errors = list(errors)
best = exceptions.best_match(errors)
reversed_best = exceptions.best_match(reversed(errors))
msg = "Di... | "array") | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_exceptions.py | test_short_paths_are_better_matches | self.assertIs | variable | 12 | from unittest import TestCase
import textwrap
from jsonschema import Draft4Validator, exceptions
class TestByRelevance(TestCase):
def test_short_paths_are_better_matches(self):
shallow = exceptions.ValidationError("Oh no!", path=["baz"])
deep = exceptions.ValidationError("Oh yes!", path=["foo", "b... | shallow) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_exceptions.py | test_if_the_most_relevant_error_is_allOf_it_is_traversed | self.assertEqual | string_literal | 38 | from unittest import TestCase
import textwrap
from jsonschema import Draft4Validator, exceptions
class TestBestMatch(TestCase):
def best_match(self, errors):
errors = list(errors)
best = exceptions.best_match(errors)
reversed_best = exceptions.best_match(reversed(errors))
msg = "Di... | "string") | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_exceptions.py | assertShows | self.assertEqual | variable | 25 | from unittest import TestCase
import textwrap
from jsonschema import Draft4Validator, exceptions
class TestErrorInitReprStr(TestCase):
def make_error(self, **kwargs):
defaults = dict(
message="hello",
validator="type",
validator_value="string",
instance=5,
... | expected) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_exceptions.py | test_unset_error | self.assertEqual | string_literal | 29 | from unittest import TestCase
import textwrap
from jsonschema import Draft4Validator, exceptions
class TestErrorInitReprStr(TestCase):
def make_error(self, **kwargs):
defaults = dict(
message="hello",
validator="type",
validator_value="string",
instance=5,
... | "message") | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_exceptions.py | test_str_works_with_instances_having_overriden_eq_operator | self.assertIn | func_call | 49 | from unittest import TestCase
import textwrap
from jsonschema import Draft4Validator, exceptions
class TestErrorInitReprStr(TestCase):
def make_error(self, **kwargs):
defaults = dict(
message="hello",
validator="type",
validator_value="string",
instance=5,
... | str(error)) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_exceptions.py | test_it_does_not_contain_subtrees_that_are_not_in_the_instance | self.assertRaises | variable | 13 | from unittest import TestCase
import textwrap
from jsonschema import Draft4Validator, exceptions
class TestErrorTree(TestCase):
def test_it_does_not_contain_subtrees_that_are_not_in_the_instance(self):
error = exceptions.ValidationError("123", validator="foo", instance=[])
tree = exceptions.Error... | IndexError) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_exceptions.py | test_it_creates_a_child_tree_for_each_nested_path | self.assertIn | complex_expr | 15 | from unittest import TestCase
import textwrap
from jsonschema import Draft4Validator, exceptions
class TestErrorTree(TestCase):
def test_it_creates_a_child_tree_for_each_nested_path(self):
errors = [
exceptions.ValidationError("a bar message", path=["bar"]),
exceptions.ValidationE... | tree["bar"]) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_it_catches_registered_errors | self.assertIs | variable | 24 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | BOOM) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_it_raises_a_key_error_for_unknown_formats | self.assertRaises | variable | 18 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | KeyError) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_it_catches_registered_errors | self.assertRaises | func_call | 28 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | type(BANG)) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_it_catches_registered_errors | self.assertRaises | variable | 21 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | FormatError) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_format_error_causes_become_validation_error_causes | self.assertRaises | variable | 22 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | ValidationError) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_it_can_validate_no_formats | self.assertFalse | complex_expr | 18 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | checker.checkers) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_uuid_format | self.assertTrue | func_call | 19 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | checker.conforms(1, "uuid")) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_it_can_register_cls_checkers | self.assertEqual | func_call | 21 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | dict(original, boom=(boom, ()))) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_duration_format | self.assertTrue | func_call | 24 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | checker.conforms(1, "duration")) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_uuid_format | self.assertFalse | func_call | 23 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | checker.conforms("test", "uuid")) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_duration_format | self.assertTrue | func_call | 25 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | checker.conforms("P4Y", "duration")) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_duration_format | self.assertFalse | func_call | 26 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | checker.conforms("test", "duration")) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_it_can_register_checkers | self.assertEqual | func_call | 20 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | dict(FormatChecker.checkers, boom=(boom, ()))) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_repr | self.assertEqual | string_literal | 22 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | "<FormatChecker checkers=['bar', 'baz', 'foo']>") | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_format.py | test_uuid_format | self.assertTrue | func_call | 20 | from unittest import TestCase
from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
def boom(thing):
if thing == "bang":
raise BANG
raise BOOM
class TestFormatChecker(TestCase)... | checker.conforms("6e6659ec-4503-4428-9f03-2e2ea4d6c278", "uuid")) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_types.py | test_type_check_can_raise_key_error | self.assertIs | variable | 49 | from collections import namedtuple
from unittest import TestCase
from jsonschema import ValidationError, _validators
from jsonschema._types import TypeChecker
from jsonschema.exceptions import UndefinedTypeCheck, UnknownType
from jsonschema.validators import Draft4Validator, extend
def equals_2(checker, instance):
... | error) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_types.py | test_type_check_can_raise_key_error | self.assertRaises | variable | 46 | from collections import namedtuple
from unittest import TestCase
from jsonschema import ValidationError, _validators
from jsonschema._types import TypeChecker
from jsonschema.exceptions import UndefinedTypeCheck, UnknownType
from jsonschema.validators import Draft4Validator, extend
def equals_2(checker, instance):
... | KeyError) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_types.py | test_unknown_type | self.assertRaises | variable | 31 | from collections import namedtuple
from unittest import TestCase
from jsonschema import ValidationError, _validators
from jsonschema._types import TypeChecker
from jsonschema.exceptions import UndefinedTypeCheck, UnknownType
from jsonschema.validators import Draft4Validator, extend
def equals_2(checker, instance):
... | UnknownType) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_types.py | test_is_type | self.assertEqual | collection | 31 | from collections import namedtuple
from unittest import TestCase
from jsonschema import ValidationError, _validators
from jsonschema._types import TypeChecker
from jsonschema.exceptions import UndefinedTypeCheck, UnknownType
from jsonschema.validators import Draft4Validator, extend
def equals_2(checker, instance):
... | (True, False)) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_types.py | test_remove | self.assertEqual | func_call | 31 | from collections import namedtuple
from unittest import TestCase
from jsonschema import ValidationError, _validators
from jsonschema._types import TypeChecker
from jsonschema.exceptions import UndefinedTypeCheck, UnknownType
from jsonschema.validators import Draft4Validator, extend
def equals_2(checker, instance):
... | TypeChecker()) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_types.py | test_simple_type_can_be_extended | self.assertRaises | variable | 50 | from collections import namedtuple
from unittest import TestCase
from jsonschema import ValidationError, _validators
from jsonschema._types import TypeChecker
from jsonschema.exceptions import UndefinedTypeCheck, UnknownType
from jsonschema.validators import Draft4Validator, extend
def equals_2(checker, instance):
... | ValidationError) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_types.py | test_unknown_type | self.assertIn | func_call | 33 | from collections import namedtuple
from unittest import TestCase
from jsonschema import ValidationError, _validators
from jsonschema._types import TypeChecker
from jsonschema.exceptions import UndefinedTypeCheck, UnknownType
from jsonschema.validators import Draft4Validator, extend
def equals_2(checker, instance):
... | str(e.exception)) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_types.py | test_is_unknown_type | self.assertRaises | variable | 31 | from collections import namedtuple
from unittest import TestCase
from jsonschema import ValidationError, _validators
from jsonschema._types import TypeChecker
from jsonschema.exceptions import UndefinedTypeCheck, UnknownType
from jsonschema.validators import Draft4Validator, extend
def equals_2(checker, instance):
... | UndefinedTypeCheck) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_types.py | test_is_unknown_type | self.assertIn | func_call | 33 | from collections import namedtuple
from unittest import TestCase
from jsonschema import ValidationError, _validators
from jsonschema._types import TypeChecker
from jsonschema.exceptions import UndefinedTypeCheck, UnknownType
from jsonschema.validators import Draft4Validator, extend
def equals_2(checker, instance):
... | str(context.exception)) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_types.py | test_checks_can_be_added_at_init | self.assertEqual | func_call | 32 | from collections import namedtuple
from unittest import TestCase
from jsonschema import ValidationError, _validators
from jsonschema._types import TypeChecker
from jsonschema.exceptions import UndefinedTypeCheck, UnknownType
from jsonschema.validators import Draft4Validator, extend
def equals_2(checker, instance):
... | TypeChecker().redefine("two", equals_2)) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_types.py | test_redefine_many | self.assertEqual | func_call | 31 | from collections import namedtuple
from unittest import TestCase
from jsonschema import ValidationError, _validators
from jsonschema._types import TypeChecker
from jsonschema.exceptions import UndefinedTypeCheck, UnknownType
from jsonschema.validators import Draft4Validator, extend
def equals_2(checker, instance):
... | TypeChecker().redefine("foo", int).redefine("bar", str)) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_utils.py | test_none | self.assertTrue | func_call | 8 | from unittest import TestCase
from jsonschema._utils import equal
class TestEqual(TestCase):
def test_none(self):
self.assertTrue( | equal(None, None)) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_utils.py | test_equal_dictionaries | self.assertTrue | func_call | 10 | from unittest import TestCase
from jsonschema._utils import equal
class TestDictEqual(TestCase):
def test_equal_dictionaries(self):
dict_1 = {"a": "b", "c": "d"}
dict_2 = {"c": "d", "a": "b"}
self.assertTrue( | equal(dict_1, dict_2)) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_utils.py | test_one_none | self.assertFalse | func_call | 11 | from unittest import TestCase
from jsonschema._utils import equal
class TestListEqual(TestCase):
def test_one_none(self):
list_1 = None
list_2 = []
self.assertFalse( | equal(list_1, list_2)) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_utils.py | test_same_item | self.assertTrue | func_call | 10 | from unittest import TestCase
from jsonschema._utils import equal
class TestDictEqual(TestCase):
def test_same_item(self):
dict_1 = {"a": "b", "c": "d"}
self.assertTrue( | equal(dict_1, dict_1)) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_validators.py | test_iter_errors | self.assertEqual | numeric_literal | 58 | from collections import deque, namedtuple
from contextlib import contextmanager
from decimal import Decimal
from io import BytesIO
from unittest import TestCase
from urllib.request import pathname2url
import json
import os
import sys
import tempfile
import unittest
from twisted.trial.unittest import SynchronousTestCas... | 1) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_validators.py | test_iter_errors_multiple_failures_one_validator | self.assertEqual | numeric_literal | 39 | from collections import deque, namedtuple
from contextlib import contextmanager
from decimal import Decimal
from io import BytesIO
from unittest import TestCase
from urllib.request import pathname2url
import json
import os
import sys
import tempfile
import unittest
from twisted.trial.unittest import SynchronousTestCas... | 4) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_validators.py | test_anyOf | self.assertEqual | numeric_literal | 55 | from collections import deque, namedtuple
from contextlib import contextmanager
from decimal import Decimal
from io import BytesIO
from unittest import TestCase
from urllib.request import pathname2url
import json
import os
import sys
import tempfile
import unittest
from twisted.trial.unittest import SynchronousTestCas... | 2) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_validators.py | test_anyOf | self.assertIs | variable | 63 | from collections import deque, namedtuple
from contextlib import contextmanager
from decimal import Decimal
from io import BytesIO
from unittest import TestCase
from urllib.request import pathname2url
import json
import os
import sys
import tempfile
import unittest
from twisted.trial.unittest import SynchronousTestCas... | e) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
python-jsonschema/jsonschema | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | train | train | jsonschema/tests/test_validators.py | test_anyOf | self.assertEqual | numeric_literal | 93 | from collections import deque, namedtuple
from contextlib import contextmanager
from decimal import Decimal
from io import BytesIO
from unittest import TestCase
from urllib.request import pathname2url
import json
import os
import sys
import tempfile
import unittest
from twisted.trial.unittest import SynchronousTestCas... | 0) | 3992d99a74099c99cc02338ecffa5647d0a2bdc4 | 349 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.