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
xflr6/graphviz
import contextlib import pathlib import os import shutil import subprocess import pytest import graphviz from graphviz import _tools from graphviz.backend import rendering import _common TEST_FILES_DIRECTORY = pathlib.Path(__file__).parent.parent def files_path(): return TEST_FILES_DIRECTORY @pytest.mark.exe ...
str(rendered_rel)
assert
func_call
tests/backend/test_rendering.py
test_render_img
92
null
xflr6/graphviz
import pytest import graphviz from graphviz import jupyter_integration EXPECTED_SVG_ENCODING = 'utf-8' @pytest.mark.exe @pytest.mark.parametrize('input_encoding', ['utf-8', 'ascii', 'latin1']) def test_repr_image_svg_xml_encoding_mocked(mocker, mock_pipe_lines_string, mock...
mock_pipe_lines.return_value.decode.return_value
assert
complex_expr
tests/test_jupyter_integration.py
test_repr_image_svg_xml_encoding_mocked
53
null
xflr6/graphviz
import pytest import graphviz from graphviz import parameters VERIFY_FUNCS = [parameters.verify_engine, parameters.verify_format, parameters.verify_renderer, parameters.verify_formatter] @pytest.mark.parametrize( 'cls', [graphviz.Graph, graphviz.Digraph, graphviz.S...
format
assert
variable
tests/test_parameters.py
test_parameters
25
null
xflr6/graphviz
import errno import io import subprocess import pytest import graphviz from graphviz.backend import execute import _common def empty_path(monkeypatch): monkeypatch.setenv('PATH', '') def test_run_check_input_lines_mocked(mocker, sentinel, mock_popen, line=b'sp\xc3\xa4m'): ...
mock_out
assert
variable
tests/backend/test_execute.py
test_run_check_input_lines_mocked
74
null
xflr6/graphviz
import subprocess import pytest import graphviz import _common @pytest.mark.parametrize( 'stdout, expected', [('dot - graphviz version 1.2.3 (mocked)', (1, 2, 3)), ('dot - graphviz version 2.43.20190912.0211 (20190912.0211)\n', (2, 43, 20190912, 211)), ('dot - graphviz version 2.44.2~dev.20200927....
expected
assert
variable
tests/backend/test_upstream_version.py
test_version_mocked
31
null
xflr6/graphviz
import subprocess import pytest import graphviz def test_view_mocked(mocker, mock_platform, mock_popen, mock_startfile, quiet): assert graphviz.view('nonfilepath', quiet=quiet) is None if mock_platform == 'windows': mock_startfile.assert_called_once_with(
'nonfilepath')
assert_*
string_literal
tests/backend/test_viewing.py
test_view_mocked
18
null
xflr6/graphviz
import itertools import pytest import graphviz BASE_GRAPHS = [graphviz.Graph, graphviz.Digraph] def cls(request): return request.param def classes(request): return request.param @pytest.mark.parametrize( 'cls, body_lines, expected', [(graphviz.Graph, ['\tspam -- {\n', '\t\teggs, ham\n', '\t}\n'], ...
expected
assert
variable
tests/test_graphs.py
test_init_body
36
null
xflr6/graphviz
import contextlib import pathlib import os import shutil import subprocess import pytest import graphviz from graphviz import _tools from graphviz.backend import rendering import _common TEST_FILES_DIRECTORY = pathlib.Path(__file__).parent.parent def files_path(): return TEST_FILES_DIRECTORY @pytest.mark.para...
[_common.EXPECTED_DOT_BINARY, '-Kdot', '-Tpdf', '-n1', '-O', 'nonfilepath'])
assert_*
collection
tests/backend/test_rendering.py
test_render_mocked
139
null
xflr6/graphviz
import io import re import subprocess import pytest import graphviz import _common SVG_PATTERN = r'(?s)^<\?xml .+</svg>\s*$' def test_pipe_string_mocked(capsys, mock_run, quiet, encoding='ascii'): mock_run.return_value = subprocess.CompletedProcess(_common.INVALID_CMD, ...
'stdout'
assert
string_literal
tests/backend/test_piping.py
test_pipe_string_mocked
113
null
xflr6/graphviz
import subprocess import pytest import graphviz import _common def test_version_parsefail_mocked(mock_run): mock_run.return_value = subprocess.CompletedProcess(_common.INVALID_CMD, returncode=0, stdou...
RuntimeError, match=r'nonversioninfo')
pytest.raises
complex_expr
tests/backend/test_upstream_version.py
test_version_parsefail_mocked
46
null
xflr6/graphviz
import pytest SKIP_EXE = '--skip-exe' ONLY_EXE = '--only-exe' def pytest_configure(config): config.addinivalue_line('markers', f'exe(xfail): skip/xfail if {SKIP_EXE} is given') def pytest_collection_modifyitems(config, items): if config.getoption(ONLY_EXE, None) or config.getopti...
1
assert
numeric_literal
tests/conftest.py
_make_exe_marker
36
null
xflr6/graphviz
import pytest import graphviz from graphviz import parameters VERIFY_FUNCS = [parameters.verify_engine, parameters.verify_format, parameters.verify_renderer, parameters.verify_formatter] @pytest.mark.parametrize( 'cls', [graphviz.Graph, graphviz.Digraph, graphviz.S...
cls
assert
variable
tests/test_parameters.py
test_parameters
22
null
xflr6/graphviz
import io import re import subprocess import pytest import graphviz import _common SVG_PATTERN = r'(?s)^<\?xml .+</svg>\s*$' def test_pipe_mocked(capsys, mock_run, quiet): mock_run.return_value = subprocess.CompletedProcess(_common.INVALID_CMD, returncode...
b'stdout'
assert
string_literal
tests/backend/test_piping.py
test_pipe_mocked
95
null
xflr6/graphviz
import subprocess import pytest import graphviz def test_view_mocked(mocker, mock_platform, mock_popen, mock_startfile, quiet): assert graphviz.view('nonfilepath', quiet=quiet) is
None
assert
none_literal
tests/backend/test_viewing.py
test_view_mocked
15
null
xflr6/graphviz
import contextlib import pathlib import os import shutil import subprocess import pytest import graphviz from graphviz import _tools from graphviz.backend import rendering import _common TEST_FILES_DIRECTORY = pathlib.Path(__file__).parent.parent def files_path(): return TEST_FILES_DIRECTORY @pytest.mark.para...
expected_result
assert
variable
tests/backend/test_rendering.py
test_get_format
204
null
xflr6/graphviz
import itertools import pytest import graphviz BASE_GRAPHS = [graphviz.Graph, graphviz.Digraph] def cls(request): return request.param def classes(request): return request.param @pytest.mark.exe @pytest.mark.parametrize( 'cls, expected', [(graphviz.Graph, 'graph {\n\tC\n}\n'), (graphviz.Digra...
str(rendered)
assert
func_call
tests/test_graphs.py
test_subgraph_render
56
null
xflr6/graphviz
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_init(source): assert sourc...
SOURCE['directory']
assert
complex_expr
tests/test_sources.py
test_init
28
null
xflr6/graphviz
import itertools import pytest import graphviz BASE_GRAPHS = [graphviz.Graph, graphviz.Digraph] def cls(request): return request.param def classes(request): return request.param @pytest.mark.parametrize( 'keep_attrs', [False, True]) def test_clear(cls, keep_attrs): kwargs = {f'{a}_attr': {a: a} fo...
1
assert
numeric_literal
tests/test_graphs.py
test_clear
72
null
xflr6/graphviz
import pytest import graphviz DEFAULT_ENGINE = 'dot' DEFAULT_FORMAT = 'pdf' DEFAULT_JUPYTER_FORMAT = 'svg' DEFAULT_JUPYTER_MIMETYPE = 'image/svg+xml' def test_set_default_format_invalid(): with pytest.raises(
ValueError, match=r'unknown format')
pytest.raises
complex_expr
tests/test_init.py
test_set_default_format_invalid
20
null
xflr6/graphviz
import io import re import subprocess import pytest import graphviz import _common SVG_PATTERN = r'(?s)^<\?xml .+</svg>\s*$' def test_pipe_lines_string_mocked(capsys, mock_popen, quiet, encoding='ascii'): proc = mock_popen.return_value proc.configure_mock(args=_common.INVA...
'nongraph\n'
assert
string_literal
tests/backend/test_piping.py
test_pipe_lines_string_mocked
163
null
xflr6/graphviz
import pytest import graphviz from graphviz import jupyter_integration EXPECTED_SVG_ENCODING = 'utf-8' @pytest.mark.exe @pytest.mark.parametrize('input_encoding', ['utf-8', 'ascii', 'latin1']) def test_repr_image_svg_xml_encoding_mocked(mocker, mock_pipe_lines_string, mock...
EXPECTED_SVG_ENCODING)
assert_*
variable
tests/test_jupyter_integration.py
test_repr_image_svg_xml_encoding_mocked
59
null
xflr6/graphviz
import pytest import graphviz from graphviz import jupyter_integration EXPECTED_SVG_ENCODING = 'utf-8' def test_get_jupyter_format_mimetype_invalid_raises_unknown(): with pytest.raises(
ValueError, match=r'unknown')
pytest.raises
complex_expr
tests/test_jupyter_integration.py
test_get_jupyter_format_mimetype_invalid_raises_unknown
10
null
xflr6/graphviz
import locale import pathlib import re import subprocess import pytest import graphviz import _common ALL_CLASSES = [graphviz.Graph, graphviz.Digraph, graphviz.Source] def cls(request): return request.param def dot(cls): if cls.__name__ == 'Source': return cls('digraph { hello -> world }\n') r...
None
assert
none_literal
tests/test_all_classes.py
test_unflatten_mocked
386
null
xflr6/graphviz
import errno import io import subprocess import pytest import graphviz from graphviz.backend import execute import _common def empty_path(monkeypatch): monkeypatch.setenv('PATH', '') def test_run_check_input_lines_mocked(mocker, sentinel, mock_popen, line=b'sp\xc3\xa4m'): ...
sentinel.encoding)
assert_*
complex_expr
tests/backend/test_execute.py
test_run_check_input_lines_mocked
84
null
xflr6/graphviz
import functools import os import warnings import pytest from graphviz import _tools import _common def itertree(root): for path, dirs, files in os.walk(root): base = os.path.relpath(path, root) rel_path = functools.partial(os.path.join, base if base != '.' else '') for is_file, names in...
[(False, 'spam'), (False, 'spam/eggs')]
assert
collection
tests/test_tools.py
test_mkdirs
34
null
xflr6/graphviz
import subprocess import pytest import graphviz import _common @pytest.mark.parametrize( 'stdout, expected', [('dot - graphviz version 1.2.3 (mocked)', (1, 2, 3)), ('dot - graphviz version 2.43.20190912.0211 (20190912.0211)\n', (2, 43, 20190912, 211)), ('dot - graphviz version 2.44.2~dev.20200927....
[_common.EXPECTED_DOT_BINARY, '-V'])
assert_*
collection
tests/backend/test_upstream_version.py
test_version_mocked
33
null
xflr6/graphviz
import itertools import pytest import graphviz BASE_GRAPHS = [graphviz.Graph, graphviz.Digraph] def cls(request): return request.param def classes(request): return request.param def test_init_filename(cls): assert cls().filename == f'{cls.__name__}.gv' assert type('Subcls', (cls,), {})().filename ...
'spam.gv'
assert
string_literal
tests/test_graphs.py
test_init_filename
24
null
xflr6/graphviz
import pytest import graphviz from graphviz import parameters VERIFY_FUNCS = [parameters.verify_engine, parameters.verify_format, parameters.verify_renderer, parameters.verify_formatter] @pytest.mark.parametrize( 'cls', [graphviz.Graph, graphviz.Digraph, graphviz.S...
dot
assert
variable
tests/test_parameters.py
test_parameters
31
null
xflr6/graphviz
import locale import pathlib import re import subprocess import pytest import graphviz import _common ALL_CLASSES = [graphviz.Graph, graphviz.Digraph, graphviz.Source] def cls(request): return request.param def dot(cls): if cls.__name__ == 'Source': return cls('digraph { hello -> world }\n') r...
None)
assert_*
none_literal
tests/test_all_classes.py
test_render_mocked
116
null
xflr6/graphviz
import pytest import graphviz from graphviz import jupyter_integration EXPECTED_SVG_ENCODING = 'utf-8' @pytest.mark.exe @pytest.mark.parametrize('input_encoding', ['utf-8', 'ascii', 'latin1']) def test_repr_image_svg_xml_encoding_mocked(mocker, mock_pipe_lines_string, mock...
mock_pipe_lines.call_args.kwargs
assert
complex_expr
tests/test_jupyter_integration.py
test_repr_image_svg_xml_encoding_mocked
58
null
xflr6/graphviz
import contextlib import pathlib import os import shutil import subprocess import pytest import graphviz from graphviz import _tools from graphviz.backend import rendering import _common TEST_FILES_DIRECTORY = pathlib.Path(__file__).parent.parent def files_path(): return TEST_FILES_DIRECTORY @pytest.mark.exe ...
len(source)
assert
func_call
tests/backend/test_rendering.py
test_render_outfile_differnt_parent
109
null
xflr6/graphviz
import io import re import subprocess import pytest import graphviz import _common SVG_PATTERN = r'(?s)^<\?xml .+</svg>\s*$' def test_pipe_pipe_invalid_data_mocked(mocker, sentinel, mock_run, quiet): mock_sys_stderr = mocker.patch('sys.stderr', autospec=True, flush=mocker.Moc...
mock_err
assert
variable
tests/backend/test_piping.py
test_pipe_pipe_invalid_data_mocked
52
null
xflr6/graphviz
import pytest import graphviz from graphviz import jupyter_integration EXPECTED_SVG_ENCODING = 'utf-8' @pytest.mark.exe @pytest.mark.parametrize('input_encoding', ['utf-8', 'ascii', 'latin1']) def test_repr_image_svg_xml_encoding_mocked(mocker, mock_pipe_lines_string, mock...
mock_pipe_lines_string.return_value
assert
complex_expr
tests/test_jupyter_integration.py
test_repr_image_svg_xml_encoding_mocked
45
null
xflr6/graphviz
import locale import pathlib import re import subprocess import pytest import graphviz import _common ALL_CLASSES = [graphviz.Graph, graphviz.Digraph, graphviz.Source] def cls(request): return request.param def dot(cls): if cls.__name__ == 'Source': return cls('digraph { hello -> world }\n') r...
renderer
assert
variable
tests/test_all_classes.py
test_format_renderer_formatter_mocked
167
null
xflr6/graphviz
import errno import io import subprocess import pytest import graphviz from graphviz.backend import execute import _common def empty_path(monkeypatch): monkeypatch.setenv('PATH', '') @pytest.mark.usefixtures('empty_path') @pytest.mark.parametrize( 'func, args', [(graphviz.render, ['dot', 'pdf', 'nonfil...
graphviz.ExecutableNotFound, match=r'execute')
pytest.raises
complex_expr
tests/backend/test_execute.py
test_missing_executable
26
null
xflr6/graphviz
import re import subprocess import pytest import graphviz import _common def test_unflatten_mocked(capsys, sentinel, mock_run, stagger=10, fanout=True, chain=23): mock_run.return_value = subprocess.CompletedProcess(_common.INVALID_CMD, ...
('', '')
assert
collection
tests/backend/test_unflattening.py
test_unflatten_mocked
45
null
xflr6/graphviz
import re import subprocess import pytest import graphviz import _common @pytest.mark.exe @pytest.mark.parametrize( 'source, kwargs, expected', [('digraph {1 -> 2; 1 -> 3; 1 -> 4}', {'stagger': 3, 'fanout': True, 'chain': 42}, 'digraph { 1 -> 2 [minlen=1]; 1 -> 3 [minlen=2]; 1 -> 4 [minlen=3]; }...
expected
assert
variable
tests/backend/test_unflattening.py
test_unflatten
25
null
xflr6/graphviz
import locale import pathlib import re import subprocess import pytest import graphviz import _common ALL_CLASSES = [graphviz.Graph, graphviz.Digraph, graphviz.Source] def cls(request): return request.param def dot(cls): if cls.__name__ == 'Source': return cls('digraph { hello -> world }\n') r...
0o777)
assert_*
complex_expr
tests/test_all_classes.py
test_save_mocked
218
null
xflr6/graphviz
import itertools import pytest import graphviz BASE_GRAPHS = [graphviz.Graph, graphviz.Digraph] def cls(request): return request.param def classes(request): return request.param @pytest.mark.parametrize( 'cls, expected', [(graphviz.Graph, 'graph {\n\t// comment\n\tsubgraph name {\n\t}\n}\n'), ...
dot.format
assert
complex_expr
tests/test_graphs.py
test_subgraph_graph_none
140
null
xflr6/graphviz
import itertools import pytest import graphviz BASE_GRAPHS = [graphviz.Graph, graphviz.Digraph] def cls(request): return request.param def classes(request): return request.param @pytest.mark.parametrize( 'cls, expected', [(graphviz.Graph, 'graph {\n\t// comment\n\tsubgraph name {\n\t}\n}\n'), ...
None
assert
none_literal
tests/test_graphs.py
test_subgraph_graph_none
143
null
xflr6/graphviz
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_from_file(tmp_path, filename='...
filename
assert
variable
tests/test_sources.py
test_from_file
67
null
xflr6/graphviz
import errno import io import subprocess import pytest import graphviz from graphviz.backend import execute import _common def empty_path(monkeypatch): monkeypatch.setenv('PATH', '') def test_run_check_input_lines_mocked(mocker, sentinel, mock_popen, line=b'sp\xc3\xa4m'): ...
proc.args
assert
complex_expr
tests/backend/test_execute.py
test_run_check_input_lines_mocked
72
null
xflr6/graphviz
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_from_file(tmp_path, filename='...
renderer
assert
variable
tests/test_sources.py
test_from_file
70
null
xflr6/graphviz
import contextlib import pathlib import os import shutil import subprocess import pytest import graphviz from graphviz import _tools from graphviz.backend import rendering import _common TEST_FILES_DIRECTORY = pathlib.Path(__file__).parent.parent def files_path(): return TEST_FILES_DIRECTORY @pytest.mark.exe ...
str(rendered)
assert
func_call
tests/backend/test_rendering.py
test_render
67
null
xflr6/graphviz
import graphviz def test_saves_source_from_file(tmp_path, src='graph spam { spam }'): path = tmp_path / 'spam.gv' path.write_text(src) stat_before = path.stat() source = graphviz.Source.from_file(path) source.save() assert path.stat().st_mtime == stat_before.st_mtime, 'file not overwritten' ...
f'{src}\n'
assert
string_literal
tests/test_saving.py
test_saves_source_from_file
14
null
xflr6/graphviz
import errno import io import subprocess import pytest import graphviz from graphviz.backend import execute import _common def empty_path(monkeypatch): monkeypatch.setenv('PATH', '') def test_run_check_input_lines_mocked(mocker, sentinel, mock_popen, line=b'sp\xc3\xa4m'): ...
proc.returncode
assert
complex_expr
tests/backend/test_execute.py
test_run_check_input_lines_mocked
73
null
xflr6/graphviz
import locale import pathlib import re import subprocess import pytest import graphviz import _common ALL_CLASSES = [graphviz.Graph, graphviz.Digraph, graphviz.Source] def cls(request): return request.param def dot(cls): if cls.__name__ == 'Source': return cls('digraph { hello -> world }\n') r...
filename
assert
variable
tests/test_all_classes.py
test_save_mocked
216
null
xflr6/graphviz
import io import re import subprocess import pytest import graphviz import _common SVG_PATTERN = r'(?s)^<\?xml .+</svg>\s*$' @pytest.mark.exe @pytest.mark.parametrize( 'engine, format_, renderer, formatter, pattern', [('dot', 'svg', None, None, SVG_PATTERN), ('dot', 'ps', 'ps', 'core', r'%!PS-'), ...
('', '')
assert
collection
tests/backend/test_piping.py
test_pipe
86
null
xflr6/graphviz
import re import subprocess import pytest import graphviz import _common def test_unflatten_mocked(capsys, sentinel, mock_run, stagger=10, fanout=True, chain=23): mock_run.return_value = subprocess.CompletedProcess(_common.INVALID_CMD, ...
sentinel.stdout
assert
complex_expr
tests/backend/test_unflattening.py
test_unflatten_mocked
37
null
xflr6/graphviz
import contextlib import pathlib import os import shutil import subprocess import pytest import graphviz from graphviz import _tools from graphviz.backend import rendering import _common TEST_FILES_DIRECTORY = pathlib.Path(__file__).parent.parent def files_path(): return TEST_FILES_DIRECTORY @pytest.mark.para...
('', '' if quiet else 'stderr')
assert
collection
tests/backend/test_rendering.py
test_render_mocked
146
null
xflr6/graphviz
import io import re import subprocess import pytest import graphviz import _common SVG_PATTERN = r'(?s)^<\?xml .+</svg>\s*$' @pytest.mark.exe @pytest.mark.xfail('graphviz.version() == (2, 36, 0)', reason='https://bugs.launchpad.net/ubuntu/+source/graphviz/+bug/1694108', raises...
''
assert
string_literal
tests/backend/test_piping.py
test_pipe_invalid_data
25
null
xflr6/graphviz
import itertools import pytest import graphviz BASE_GRAPHS = [graphviz.Graph, graphviz.Digraph] def cls(request): return request.param def classes(request): return request.param @pytest.mark.parametrize( 'cls, expected', [(graphviz.Graph, 'graph {\n\t// comment\n\tsubgraph name {\n\t}\n}\n'), ...
False
assert
bool_literal
tests/test_graphs.py
test_subgraph_graph_none
136
null
xflr6/graphviz
import io import re import subprocess import pytest import graphviz import _common SVG_PATTERN = r'(?s)^<\?xml .+</svg>\s*$' def test_pipe_pipe_invalid_data_mocked(mocker, sentinel, mock_run, quiet): mock_sys_stderr = mocker.patch('sys.stderr', autospec=True, flush=mocker.Moc...
mock_out
assert
variable
tests/backend/test_piping.py
test_pipe_pipe_invalid_data_mocked
51
null
xflr6/graphviz
import contextlib import pathlib import os import shutil import subprocess import pytest import graphviz from graphviz import _tools from graphviz.backend import rendering import _common TEST_FILES_DIRECTORY = pathlib.Path(__file__).parent.parent def files_path(): return TEST_FILES_DIRECTORY @pytest.mark.para...
f'{filepath}.pdf'
assert
string_literal
tests/backend/test_rendering.py
test_render_mocked
137
null
xflr6/graphviz
import locale import pathlib import re import subprocess import pytest import graphviz import _common ALL_CLASSES = [graphviz.Graph, graphviz.Digraph, graphviz.Source] def cls(request): return request.param def dot(cls): if cls.__name__ == 'Source': return cls('digraph { hello -> world }\n') r...
dot
assert
variable
tests/test_all_classes.py
test_copy
40
null
xflr6/graphviz
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) @pytest.mark.parametrize( 'paramete...
SOURCE[parameter].lower()
assert
func_call
tests/test_sources.py
test_source_parameter
22
null
xflr6/graphviz
import functools from unittest import mock import graphviz WRAPS = ['Graph', 'Digraph'] RENDERING_METHODS = ('pipe', 'save', 'render', 'view', 'unflatten') INPUT_PROPERTIES = ('source',) __all__ = ['LazyGraph', 'LazyDigraph'] def lazy_graph_cls(wrapped_cls_name: str): return functools.partial(create_lazy_grap...
mock.call(*args)
assert
func_call
examples/graphviz_transform_recipe.py
property_func
58
null
xflr6/graphviz
import contextlib import pathlib import os import shutil import subprocess import pytest import graphviz from graphviz import _tools from graphviz.backend import rendering import _common TEST_FILES_DIRECTORY = pathlib.Path(__file__).parent.parent def files_path(): return TEST_FILES_DIRECTORY @pytest.mark.exe ...
('', '')
assert
collection
tests/backend/test_rendering.py
test_render
71
null
xflr6/graphviz
import pytest import graphviz from graphviz import parameters VERIFY_FUNCS = [parameters.verify_engine, parameters.verify_format, parameters.verify_renderer, parameters.verify_formatter] @pytest.mark.parametrize( 'cls', [graphviz.Graph, graphviz.Digraph, graphviz.S...
engine
assert
variable
tests/test_parameters.py
test_parameters
24
null
xflr6/graphviz
import itertools import pytest import graphviz BASE_GRAPHS = [graphviz.Graph, graphviz.Digraph] def cls(request): return request.param def classes(request): return request.param def test_attr_invalid_kw(cls): with pytest.raises(
ValueError, match=r'attr')
pytest.raises
complex_expr
tests/test_graphs.py
test_attr_invalid_kw
99
null
xflr6/graphviz
import locale import pathlib import re import subprocess import pytest import graphviz import _common ALL_CLASSES = [graphviz.Graph, graphviz.Digraph, graphviz.Source] def cls(request): return request.param def dot(cls): if cls.__name__ == 'Source': return cls('digraph { hello -> world }\n') r...
format_
assert
variable
tests/test_all_classes.py
test_pipe_lines_mocked
273
null
xflr6/graphviz
import pytest import graphviz from graphviz import jupyter_integration EXPECTED_SVG_ENCODING = 'utf-8' @pytest.mark.exe def test_repr_image_svg_xml_encoding(input_encoding='latin1'): assert input_encoding !=
EXPECTED_SVG_ENCODING
assert
variable
tests/test_jupyter_integration.py
test_repr_image_svg_xml_encoding
27
null
xflr6/graphviz
import pytest import graphviz DEFAULT_ENGINE = 'dot' DEFAULT_FORMAT = 'pdf' DEFAULT_JUPYTER_FORMAT = 'svg' DEFAULT_JUPYTER_MIMETYPE = 'image/svg+xml' def test_set_default_engine(monkeypatch, *, engine='neato', explicit_engine='sfdp'): assert len({DEFAULT_ENGINE, engine, explicit_engine}) ==
3
assert
numeric_literal
tests/test_init.py
test_set_default_engine
25
null
xflr6/graphviz
import sys import warnings import pytest import graphviz from graphviz import quoting @pytest.mark.parametrize( 'char', ['G', 'E', 'T', 'H', 'L', 'l']) def test_deprecated_escape(recwarn, char): warnings.simplefilter('always') escape = eval(rf'"\{char}"') assert len(recwarn) == 1 w = recwarn.po...
f'"\\{char}"'
assert
string_literal
tests/test_quoting.py
test_deprecated_escape
23
null
xflr6/graphviz
import pytest import graphviz from graphviz import jupyter_integration EXPECTED_SVG_ENCODING = 'utf-8' def test_get_jupyter_mimetype_format_raises_unsupported(): with pytest.raises(
ValueError, match=r"unsupported .*\(must be one of .+'image/svg\+xml'")
pytest.raises
func_call
tests/test_jupyter_integration.py
test_get_jupyter_mimetype_format_raises_unsupported
20
null
xflr6/graphviz
import functools from unittest import mock import graphviz WRAPS = ['Graph', 'Digraph'] RENDERING_METHODS = ('pipe', 'save', 'render', 'view', 'unflatten') INPUT_PROPERTIES = ('source',) __all__ = ['LazyGraph', 'LazyDigraph'] def lazy_graph_cls(wrapped_cls_name: str): return functools.partial(create_lazy_grap...
getattr(mock.call, method_name)(*args, **kwargs)
assert
func_call
examples/graphviz_transform_recipe.py
call_method
44
null
xflr6/graphviz
import sys import warnings import pytest import graphviz from graphviz import quoting @pytest.mark.parametrize( 'char', ['G', 'E', 'T', 'H', 'L', 'l']) def test_deprecated_escape(recwarn, char): warnings.simplefilter('always') escape = eval(rf'"\{char}"') assert len(recwarn) == 1 w = recwarn.po...
f'\\{char}'
assert
string_literal
tests/test_quoting.py
test_deprecated_escape
22
null
xflr6/graphviz
import io import re import subprocess import pytest import graphviz import _common SVG_PATTERN = r'(?s)^<\?xml .+</svg>\s*$' @pytest.mark.exe @pytest.mark.xfail('graphviz.version() == (2, 36, 0)', reason='https://bugs.launchpad.net/ubuntu/+source/graphviz/+bug/1694108', raises...
err
assert
variable
tests/backend/test_piping.py
test_pipe_invalid_data
29
null
xflr6/graphviz
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_source_iter(source): sourc...
list(source) * 2
assert
func_call
tests/test_sources.py
test_source_iter
78
null
xflr6/graphviz
import re import subprocess import pytest import graphviz import _common def test_unflatten_mocked(capsys, sentinel, mock_run, stagger=10, fanout=True, chain=23): mock_run.return_value = subprocess.CompletedProcess(_common.INVALID_CMD, ...
[_common.EXPECTED_UNFLATTEN_BINARY, '-l', '10', '-f', '-c', '23'])
assert_*
collection
tests/backend/test_unflattening.py
test_unflatten_mocked
39
null
xflr6/graphviz
import graphviz def test_saves_source_from_file(tmp_path, src='graph spam { spam }'): path = tmp_path / 'spam.gv' path.write_text(src) stat_before = path.stat() source = graphviz.Source.from_file(path) source.save() assert path.stat().st_mtime == stat_before.st_mtime, 'file not overwritten' ...
src
assert
variable
tests/test_saving.py
test_saves_source_from_file
13
null
xflr6/graphviz
import itertools import pytest import graphviz BASE_GRAPHS = [graphviz.Graph, graphviz.Digraph] def cls(request): return request.param def classes(request): return request.param @pytest.mark.parametrize( 'cls, expected', [(graphviz.Graph, 'graph {\n\t// comment\n\tsubgraph name {\n\t}\n}\n'), ...
dot.engine
assert
complex_expr
tests/test_graphs.py
test_subgraph_graph_none
141
null
xflr6/graphviz
import locale import pathlib import re import subprocess import pytest import graphviz import _common ALL_CLASSES = [graphviz.Graph, graphviz.Digraph, graphviz.Source] def cls(request): return request.param def dot(cls): if cls.__name__ == 'Source': return cls('digraph { hello -> world }\n') r...
dot.copy()
assert
func_call
tests/test_all_classes.py
test_copy
41
null
xflr6/graphviz
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_from_file(tmp_path, filename='...
encoding
assert
variable
tests/test_sources.py
test_from_file
69
null
xflr6/graphviz
import pytest import graphviz DEFAULT_ENGINE = 'dot' DEFAULT_FORMAT = 'pdf' DEFAULT_JUPYTER_FORMAT = 'svg' DEFAULT_JUPYTER_MIMETYPE = 'image/svg+xml' def test_set_default_format(monkeypatch, *, format='png', explicit_format='jpeg'): assert len({DEFAULT_FORMAT, format, explicit_format}) == 3 from graphviz...
DEFAULT_FORMAT
assert
variable
tests/test_init.py
test_set_default_format
65
null
xflr6/graphviz
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_from_file(tmp_path, filename='...
formatter
assert
variable
tests/test_sources.py
test_from_file
71
null
xflr6/graphviz
import subprocess import pytest import graphviz import _common @pytest.mark.exe(xfail=True, raises=graphviz.ExecutableNotFound) def test_version(capsys): result = graphviz.version() assert isinstance(result, tuple) and result assert all(isinstance(d, int) for d in result) assert capsys.readouterr()...
('', '')
assert
collection
tests/backend/test_upstream_version.py
test_version
15
null
xflr6/graphviz
import itertools import pytest import graphviz BASE_GRAPHS = [graphviz.Graph, graphviz.Digraph] def cls(request): return request.param def classes(request): return request.param def test_init_filename(cls): assert cls().filename ==
f'{cls.__name__}.gv'
assert
string_literal
tests/test_graphs.py
test_init_filename
22
null
xflr6/graphviz
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_init_filename(): assert gr...
'Subcls.gv'
assert
string_literal
tests/test_sources.py
test_init_filename
33
null
xflr6/graphviz
import itertools import pytest import graphviz BASE_GRAPHS = [graphviz.Graph, graphviz.Digraph] def cls(request): return request.param def classes(request): return request.param @pytest.mark.parametrize( 'keep_attrs', [False, True]) def test_clear(cls, keep_attrs): kwargs = {f'{a}_attr': {a: a} fo...
body
assert
variable
tests/test_graphs.py
test_clear
77
null
xflr6/graphviz
import io import re import subprocess import pytest import graphviz import _common SVG_PATTERN = r'(?s)^<\?xml .+</svg>\s*$' @pytest.mark.exe @pytest.mark.xfail('graphviz.version() == (2, 36, 0)', reason='https://bugs.launchpad.net/ubuntu/+source/graphviz/+bug/1694108', raises...
1
assert
numeric_literal
tests/backend/test_piping.py
test_pipe_invalid_data
22
null
xflr6/graphviz
import io import re import subprocess import pytest import graphviz import _common SVG_PATTERN = r'(?s)^<\?xml .+</svg>\s*$' def test_pipe_lines_mocked(capsys, mock_popen, quiet, input_encoding='ascii'): proc = mock_popen.return_value proc.configure_mock(args=_common.EXPECTED_DOT...
b'nongraph\n'
assert
string_literal
tests/backend/test_piping.py
test_pipe_lines_mocked
138
null
xflr6/graphviz
import locale import pathlib import re import subprocess import pytest import graphviz import _common ALL_CLASSES = [graphviz.Graph, graphviz.Digraph, graphviz.Source] def cls(request): return request.param def dot(cls): if cls.__name__ == 'Source': return cls('digraph { hello -> world }\n') r...
'w')
assert_*
string_literal
tests/test_all_classes.py
test_save_mocked
219
null
xflr6/graphviz
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_init_filename(): assert g...
'Source.gv'
assert
string_literal
tests/test_sources.py
test_init_filename
32
null
xflr6/graphviz
import pytest import graphviz DEFAULT_ENGINE = 'dot' DEFAULT_FORMAT = 'pdf' DEFAULT_JUPYTER_FORMAT = 'svg' DEFAULT_JUPYTER_MIMETYPE = 'image/svg+xml' def test_set_default_format(monkeypatch, *, format='png', explicit_format='jpeg'): assert len({DEFAULT_FORMAT, format, explicit_format}) == 3 from graphviz...
format
assert
variable
tests/test_init.py
test_set_default_format
80
null
xflr6/graphviz
import contextlib import pathlib import os import shutil import subprocess import pytest import graphviz from graphviz import _tools from graphviz.backend import rendering import _common TEST_FILES_DIRECTORY = pathlib.Path(__file__).parent.parent def files_path(): return TEST_FILES_DIRECTORY @pytest.mark.exe ...
len(data)
assert
func_call
tests/backend/test_rendering.py
test_render
60
null
xflr6/graphviz
import locale import pathlib import re import subprocess import pytest import graphviz import _common ALL_CLASSES = [graphviz.Graph, graphviz.Digraph, graphviz.Source] def cls(request): return request.param def dot(cls): if cls.__name__ == 'Source': return cls('digraph { hello -> world }\n') r...
cls
assert
variable
tests/test_all_classes.py
test_copy
39
null
xflr6/graphviz
import pytest import graphviz from graphviz import jupyter_integration EXPECTED_SVG_ENCODING = 'utf-8' def test_get_jupyter_mimetype_format_normalizes(): assert jupyter_integration.get_jupyter_mimetype_format(
'jpeg'
assert
string_literal
tests/test_jupyter_integration.py
test_get_jupyter_mimetype_format_normalizes
15
null
xflr6/graphviz
import contextlib import pathlib import os import shutil import subprocess import pytest import graphviz from graphviz import _tools from graphviz.backend import rendering import _common TEST_FILES_DIRECTORY = pathlib.Path(__file__).parent.parent def files_path(): return TEST_FILES_DIRECTORY @pytest.mark.exe ...
subprocess.CalledProcessError)
pytest.raises
complex_expr
tests/backend/test_rendering.py
test_render_missing_file
25
null
xflr6/graphviz
import functools import os import warnings import pytest from graphviz import _tools import _common def itertree(root): for path, dirs, files in os.walk(root): base = os.path.relpath(path, root) rel_path = functools.partial(os.path.join, base if base != '.' else '') for is_file, names in...
OSError)
pytest.raises
variable
tests/test_tools.py
test_mkdirs_invalid
24
null
isso-comments/isso
import unittest import io import os from isso import config class TestConfig(unittest.TestCase): def test_parser_with_environment_variables(self): parser = config.IssoParser() parser.read_file( io.StringIO(""" [foo] bar = $TEST_ENV_VAR baz = ${TEST_...
"another_test_value")
self.assertEqual
string_literal
isso/tests/test_config.py
test_parser_with_environment_variables
TestConfig
55
null
isso-comments/isso
import unittest import os import sqlite3 import tempfile from isso import config from isso.db import SQLite3 class TestDBMigration(unittest.TestCase): def setUp(self): fd, self.path = tempfile.mkstemp() def tearDown(self): os.unlink(self.path) def test_comment_text_not_null_migration(sel...
[("",), ("foo",)])
self.assertEqual
collection
isso/tests/test_db.py
test_comment_text_not_null_migration
TestDBMigration
182
null
isso-comments/isso
import unittest import io import os from isso import config class TestConfig(unittest.TestCase): def test_parser(self): parser = config.IssoParser() parser.read_file( io.StringIO(""" [foo] bar = 1h baz = 12 spam = a, b, cdef b...
3600)
self.assertEqual
numeric_literal
isso/tests/test_config.py
test_parser
TestConfig
26
null
isso-comments/isso
import json import os import re import tempfile import unittest from urllib.parse import urlencode from werkzeug.wrappers import Response from isso import Isso, core, config from isso.utils import http from isso.views import comments from fixtures import curl, loads, FakeIP, FakeHost, JSONClient http.curl = curl ...
0)
self.assertEqual
numeric_literal
isso/tests/test_comments.py
testGetInvalid
TestComments
185
null
isso-comments/isso
import unittest from isso import utils from isso.utils import parse class TestParse(unittest.TestCase): def test_thread(self): self.assertEqual(parse.thread("asdf"), (None, "Untitled.")) self.assertEqual( parse.thread(""" <html> <head> <title>Fo...
("Fuu.", "Untitled."))
self.assertEqual
collection
isso/tests/test_utils.py
test_thread
TestParse
77
null
isso-comments/isso
import json import tempfile import unittest from werkzeug.wrappers import Response from isso import Isso, core, config from isso.utils import http from fixtures import curl, loads, FakeIP, JSONClient http.curl = curl class TestVote(unittest.TestCase): def setUp(self): self.path = tempfile.NamedTemporar...
200)
self.assertEqual
numeric_literal
isso/tests/test_vote.py
testSingleLike
TestVote
44
null
isso-comments/isso
import unittest from isso import utils from isso.utils import parse class TestUtils(unittest.TestCase): def test_anonymize(self): examples = [ ("12.34.56.78", "12.34.56.0"), ("1234:5678:90ab:cdef:fedc:ba09:8765:4321", "1234:5678:90ab:0000:0000:0000:0000:0000"), ("::ffff...
anonymized)
self.assertEqual
variable
isso/tests/test_utils.py
test_anonymize
TestUtils
18
null
isso-comments/isso
import json import tempfile import unittest from werkzeug.test import Client from werkzeug.wrappers import Response from isso import Isso, config, core from isso.utils import http from fixtures import curl, FakeIP http.curl = curl class TestGuard(unittest.TestCase): data = json.dumps({"text": "Lorem ipsum."}) ...
201)
self.assertEqual
numeric_literal
isso/tests/test_guard.py
testRateLimit
TestGuard
62
null
isso-comments/isso
import unittest from isso import config from isso.utils.hash import Hash, PBKDF2, new class TestCreate(unittest.TestCase): def test_custom(self): def _new(val): conf = config.new({"hash": {"algorithm": val, "salt": ""}}) return new(conf.section("hash")) sha1 = _new("sha1"...
Hash)
self.assertIsInstance
variable
isso/tests/test_utils_hash.py
test_custom
TestCreate
47
null
isso-comments/isso
import unittest import os import sqlite3 import tempfile from isso import config from isso.db import SQLite3 class TestDBMigration(unittest.TestCase): def setUp(self): fd, self.path = tempfile.mkstemp() def tearDown(self): os.unlink(self.path) def test_comment_text_not_null_migration(sel...
(1,))
self.assertEqual
collection
isso/tests/test_db.py
test_comment_text_not_null_migration
TestDBMigration
179
null