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
mangiucugna/json_repair
from src.json_repair.json_repair import loads, repair_json def test_stream_stable(): # default: stream_stable = False # When the json to be repaired is the accumulation of streaming json at a certain moment. # The default repair result is unstable. assert repair_json('{"key": "val\\', stream_stable=Fal...
'{"key": "val"}'
assert
string_literal
tests/test_json_repair.py
test_stream_stable
151
null
mangiucugna/json_repair
from src.json_repair.json_repair import repair_json def test_escaping(): assert repair_json("'\"'") == "" assert repair_json('{"key": \'string"\n\t\\le\'') == '{"key": "string\\"\\n\\t\\\\le"}' assert ( repair_json( r'{"real_content": "Some string: Some other string \t Some string <a hr...
'{"key_1": "value"}'
assert
string_literal
tests/test_parse_string.py
test_escaping
71
null
mangiucugna/json_repair
from src.json_repair.json_repair import repair_json def test_parse_comment(): assert repair_json("/") ==
""
assert
string_literal
tests/test_parse_comment.py
test_parse_comment
5
null
mangiucugna/json_repair
import io import json import os import tempfile from pathlib import Path from unittest.mock import patch import pytest from src.json_repair.json_repair import cli def test_cli_inline_requires_filename(capsys): """cli() should exit with an error when --inline is passed without a filename.""" with pytest.raise...
0
assert
numeric_literal
tests/test_repair_json_cli.py
test_cli_inline_requires_filename
61
null
mangiucugna/json_repair
from src.json_repair.json_repair import repair_json def test_parse_string(): assert repair_json('"') == "" assert repair_json("\n") == "" assert repair_json(" ") == "" assert repair_json("string") == "" assert repair_json("stringbeforeobject {}") ==
"{}"
assert
string_literal
tests/test_parse_string.py
test_parse_string
9
null
mangiucugna/json_repair
from src.json_repair.json_repair import repair_json def test_parse_array_edge_cases(): assert repair_json("[{]") == "[]" assert repair_json("[") == "[]" assert repair_json('["') == "[]" assert repair_json("]") ==
""
assert
string_literal
tests/test_parse_array.py
test_parse_array_edge_cases
15
null
mangiucugna/json_repair
import io import json import os import tempfile from pathlib import Path from unittest.mock import patch import pytest from src.json_repair.json_repair import cli def test_cli(capsys): # Create a temporary file temp_fd, temp_path = tempfile.mkstemp(suffix=".json") _, tempout_path = tempfile.mkstemp(suffi...
expected_output
assert
variable
tests/test_repair_json_cli.py
test_cli
52
null
mangiucugna/json_repair
from src.json_repair.json_repair import loads, repair_json def test_stream_stable(): # default: stream_stable = False # When the json to be repaired is the accumulation of streaming json at a certain moment. # The default repair result is unstable. assert repair_json('{"key": "val\\', stream_stable=Fa...
'{"key": "val\\\\"}'
assert
string_literal
tests/test_json_repair.py
test_stream_stable
150
null
mangiucugna/json_repair
import pytest from src.json_repair import repair_json from src.json_repair.json_parser import JSONParser from src.json_repair.schema_repair import SchemaRepairer from src.json_repair.utils.json_context import ContextValues def parse_object_direct(raw, schema, *, strict=False, context=None): parser = JSONParser(ra...
{}
assert
collection
tests/test_schema_parser_paths.py
test_parse_object_schema_true_false_and_non_object
36
null
mangiucugna/json_repair
import pytest pytest.importorskip("flask") from docs.app import app def client(): app.testing = True with app.test_client() as test_client: yield test_client def test_docs_api_without_schema_keeps_existing_behavior(client): response = client.post( "/api/repair-json", json={"malfo...
[{"value": "1"}, []]
assert
collection
tests/test_docs_app_schema.py
test_docs_api_without_schema_keeps_existing_behavior
23
null
mangiucugna/json_repair
import io import json import os import tempfile from pathlib import Path from unittest.mock import patch import pytest from src.json_repair.json_repair import cli def test_cli_inline_requires_filename(capsys): """cli() should exit with an error when --inline is passed without a filename.""" with pytest.rais...
SystemExit)
pytest.raises
variable
tests/test_repair_json_cli.py
test_cli_inline_requires_filename
57
null
mangiucugna/json_repair
from src.json_repair.json_repair import repair_json def test_parse_array_missing_quotes(): assert repair_json('["value1" value2", "value3"]') ==
'["value1", "value2", "value3"]'
assert
string_literal
tests/test_parse_array.py
test_parse_array_missing_quotes
53
null
mangiucugna/json_repair
import pytest from src.json_repair import repair_json from src.json_repair.json_parser import JSONParser from src.json_repair.schema_repair import SchemaRepairer from src.json_repair.utils.json_context import ContextValues def parse_object_direct(raw, schema, *, strict=False, context=None): parser = JSONParser(ra...
{"a": 1}
assert
collection
tests/test_schema_parser_paths.py
test_parse_object_schema_property_fallbacks_and_stray_colon
49
null
mangiucugna/json_repair
import pytest pytest.importorskip("flask") from docs.app import app def client(): app.testing = True with app.test_client() as test_client: yield test_client def test_docs_api_schema_guides_coercion(client): pytest.importorskip("jsonschema") schema = { "type": "object", "prop...
{"value": 1}
assert
collection
tests/test_docs_app_schema.py
test_docs_api_schema_guides_coercion
53
null
mangiucugna/json_repair
import pytest from src.json_repair.utils.string_file_wrapper import StringFileWrapper def test_string_file_wrapper_slice_variations(tmp_path): file_path = tmp_path / "slice.json" file_path.write_text("abcd", encoding="utf-8") with file_path.open("r", encoding="utf-8") as handle: wrapper = StringFi...
"ac"
assert
string_literal
tests/utils/test_string_file_wrapper.py
test_string_file_wrapper_slice_variations
38
null
mangiucugna/json_repair
import copy from typing import Any, ClassVar import pytest from src.json_repair import repair_json from src.json_repair.schema_repair import ( SchemaRepairer, load_schema_model, normalize_missing_values, normalize_schema_repair_mode, schema_from_input, ) from src.json_repair.utils.constants import...
{}
assert
collection
tests/test_schema_repairer.py
test_repair_object_and_array_paths
284
null
mangiucugna/json_repair
import pytest from src.json_repair import repair_json def repair_with_schema(raw, schema, **kwargs): return repair_json(raw, schema=schema, skip_json_loads=True, return_objects=True, **kwargs) def test_schema_boolean_coercion_is_mode_independent(): pytest.importorskip("jsonschema") schema = { "ty...
{"flag": True}
assert
collection
tests/test_schema_guided_parse.py
test_schema_boolean_coercion_is_mode_independent
149
null
mangiucugna/json_repair
import pytest from src.json_repair.utils.string_file_wrapper import StringFileWrapper def test_string_file_wrapper_slice_variations(tmp_path): file_path = tmp_path / "slice.json" file_path.write_text("abcd", encoding="utf-8") with file_path.open("r", encoding="utf-8") as handle: wrapper = StringFi...
""
assert
string_literal
tests/utils/test_string_file_wrapper.py
test_string_file_wrapper_slice_variations
37
null
mangiucugna/json_repair
from src.json_repair.json_repair import loads, repair_json def test_repair_json_with_objects(): # Test with valid JSON strings assert repair_json("[]", return_objects=True) == [] assert repair_json("{}", return_objects=True) == {} assert repair_json('{"key": true, "key2": false, "key3": null}', return_...
[1, 2, 3, 4]
assert
collection
tests/test_json_repair.py
test_repair_json_with_objects
45
null
mangiucugna/json_repair
from src.json_repair.json_repair import loads, repair_json def test_logging(): assert repair_json("{}", logging=True) ==
({}, [])
assert
collection
tests/test_json_repair.py
test_logging
164
null
mangiucugna/json_repair
import pytest from src.json_repair import repair_json from src.json_repair.json_parser import JSONParser from src.json_repair.schema_repair import SchemaRepairer from src.json_repair.utils.json_context import ContextValues def parse_object_direct(raw, schema, *, strict=False, context=None): parser = JSONParser(ra...
[1, 2]
assert
collection
tests/test_schema_parser_paths.py
test_parse_array_schema_items_and_additional_items
154
null
mangiucugna/json_repair
import io import json import os import tempfile from pathlib import Path from unittest.mock import patch import pytest from src.json_repair.json_repair import cli def test_cli_schema_file_guides_repair(tmp_path, capsys): pytest.importorskip("jsonschema") schema_path = tmp_path / "schema.json" schema = { ...
'{\n"value": 0\n}\n'
assert
string_literal
tests/test_repair_json_cli.py
test_cli_schema_file_guides_repair
88
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from petl.compat import maxint from petl.test.helpers import eq_ from petl.util.parsers import numparser, datetimeparser def test_numparser(): parsenumber = numparser() assert parsenumber('1') ==
1
assert
numeric_literal
petl/test/util/test_parsers.py
test_numparser
12
null
petl-developers/petl
from __future__ import print_function, division, absolute_import from datetime import datetime from decimal import Decimal import pytest from petl.test.helpers import eq_, ieq from petl.comparison import Comparable def test_comparable_ieq_missing(): x = ['a', 'b', 'c'] y = ['a', 'b'] with pytest.raises...
AssertionError)
pytest.raises
variable
petl/test/test_comparison.py
test_comparable_ieq_missing
200
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from collections import OrderedDict from tempfile import NamedTemporaryFile import json import pytest from petl.test.helpers import ieq from petl import fromjson, fromdicts, tojson, tojsonarrays def test_tojson(): # exercise function table = ...
2
assert
numeric_literal
petl/test/io/test_json.py
test_tojson
163
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.errors import FieldSelectionError from petl.test.helpers import eq_ from petl.util.materialise import columns, facetcolumns def test_facetcolumns_headerless(): table = [] with pytest.raises(
FieldSelectionError)
pytest.raises
variable
petl/test/util/test_materialise.py
test_facetcolumns_headerless
49
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from tempfile import NamedTemporaryFile import json from petl import fromjson, tojson from petl.test.helpers import ieq def test_tojson_1(): table = (('foo', 'bar'), ('a', 1), ('b', 2), ('c', 2)) f = Named...
3
assert
numeric_literal
petl/test/io/test_jsonl.py
test_tojson_1
65
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import math from datetime import datetime, date from decimal import Decimal from tempfile import NamedTemporaryFile import pytest from petl.compat import PY3 from petl.transform.basics import cat from petl.util.base import dicts from petl.util.vis imp...
joe
assert
variable
petl/test/io/test_avro.py
test_toavro_troubleshooting11
125
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from datetime import datetime import pytest from petl.errors import FieldSelectionError from petl.test.helpers import ieq from petl.transform.reshape import melt, recast, transpose, pivot, flatten, \ unflatten from petl.transform.regex import split...
FieldSelectionError)
pytest.raises
variable
petl/test/transform/test_reshape.py
test_pivot_headerless
404
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from petl.compat import maxint from petl.test.helpers import eq_ from petl.util.parsers import numparser, datetimeparser def test_numparser(): parsenumber = numparser() assert parsenumber('1') == 1 assert parsenumber('1.0') ==
1.0
assert
numeric_literal
petl/test/util/test_parsers.py
test_numparser
13
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from collections import OrderedDict from tempfile import NamedTemporaryFile import json import pytest from petl.test.helpers import ieq from petl import fromjson, fromdicts, tojson, tojsonarrays def dicts_generator(): def generator(): yiel...
6
assert
numeric_literal
petl/test/io/test_json.py
test_fromdicts_generator_random_access
273
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.errors import FieldSelectionError from petl.test.helpers import ieq, eq_ from petl.compat import PY3, next from petl.util.base import header, fieldnames, data, dicts, records, \ namedtuples, itervalues, values, rowgroupby, ex...
(ValueError, TypeError))
pytest.raises
collection
petl/test/util/test_base.py
test_expr_untrusted
368
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from tempfile import NamedTemporaryFile import json from petl import fromjson, tojson from petl.test.helpers import ieq def test_tojson_2(): table = [['name', 'wins'], ['Gilbert', [['straight', '7S'], ['one pair', '10H']]], ...
4
assert
numeric_literal
petl/test/io/test_jsonl.py
test_tojson_2
85
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import json from tempfile import NamedTemporaryFile from petl.test.helpers import ieq from petl.io.json import tojson, fromjson def test_json_unicode(): tbl = ((u'id', u'name'), (1, u'Արամ Խաչատրյան'), (2, u'Johann Strauß'), ...
4
assert
numeric_literal
petl/test/io/test_json_unicode.py
test_json_unicode
25
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest import petl as etl from petl.test.helpers import ieq, eq_, assert_almost_equal from petl.io.numpy import toarray, fromarray, torecarray def test_torecarray(): t = [('foo', 'bar', 'baz'), ('apples', 1, 2.5), ...
a.baz[1])
assert_*
complex_expr
petl/test/io/test_numpy.py
test_torecarray
75
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from datetime import datetime from tempfile import NamedTemporaryFile import pytest import petl as etl from petl.io.xlsx import fromxlsx, toxlsx, appendxlsx from petl.test.helpers import ieq, eq_ openpyxl = pytest.importorskip("openpyxl") def xlsx_te...
str(excinfo.value)
assert
func_call
petl/test/io/test_xlsx.py
test_toxlsx_add_sheet_match
203
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from petl.compat import maxint from petl.test.helpers import eq_ from petl.util.parsers import numparser, datetimeparser def test_numparser(): parsenumber = numparser() assert parsenumber('1') == 1 assert parsenumber('1.0') == 1.0 asser...
3 + 4j
assert
complex_expr
petl/test/util/test_parsers.py
test_numparser
15
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.errors import FieldSelectionError from petl.test.helpers import ieq, eq_ from petl.compat import PY3, next from petl.util.base import header, fieldnames, data, dicts, records, \ namedtuples, itervalues, values, rowgroupby, ex...
None
assert
none_literal
petl/test/util/test_base.py
test_expr_nok
345
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from tempfile import NamedTemporaryFile import json from petl import fromjson, tojson from petl.test.helpers import ieq def test_tojson_2(): table = [['name', 'wins'], ['Gilbert', [['straight', '7S'], ['one pair', '10H']]], ...
[]
assert
collection
petl/test/io/test_jsonl.py
test_tojson_2
91
null
petl-developers/petl
import random as pyrandom import time from functools import partial from petl.util.random import randomseed, randomtable, RandomTable, dummytable, DummyTable def test_randomseed(): """ Ensure that randomseed provides a non-empty string that changes. """ seed_1 = randomseed() time.sleep(1) seed...
seed_2
assert
variable
petl/test/util/test_random.py
test_randomseed
18
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import math from datetime import datetime, date from decimal import Decimal from tempfile import NamedTemporaryFile import pytest from petl.compat import PY3 from petl.transform.basics import cat from petl.util.base import dicts from petl.util.vis imp...
bob
assert
variable
petl/test/io/test_avro.py
test_toavro_troubleshooting10
114
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from collections import OrderedDict from tempfile import NamedTemporaryFile import json import pytest from petl.test.helpers import ieq from petl import fromjson, fromdicts, tojson, tojsonarrays def test_tojson(): # exercise function table = ...
3
assert
numeric_literal
petl/test/io/test_json.py
test_tojson
159
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.test.helpers import ieq from petl.errors import FieldSelectionError from petl.util import fieldnames from petl.transform.headers import setheader, extendheader, pushheader, skip, \ rename, prefixheader, suffixheader, sorthead...
('foo', 'bar')
assert
collection
petl/test/transform/test_headers.py
test_rename_strict
234
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.compat import next from petl.errors import ArgumentError from petl.test.helpers import ieq, eq_ from petl.transform.regex import capture, split, search, searchcomplement, splitdown from petl.transform.basics import TransformError...
ArgumentError)
pytest.raises
variable
petl/test/transform/test_regex.py
test_capture_headerless
62
null
petl-developers/petl
import random as pyrandom import time from functools import partial from petl.util.random import randomseed, randomtable, RandomTable, dummytable, DummyTable def test_randomseed(): """ Ensure that randomseed provides a non-empty string that changes. """ seed_1 = randomseed() time.sleep(1) seed...
""
assert
string_literal
petl/test/util/test_random.py
test_randomseed
17
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.errors import FieldSelectionError from petl.test.helpers import ieq, eq_ from petl.comparison import Comparable from petl.transform.selects import select, selectin, selectcontains, \ rowlenselect, selectusingcontext, facet, s...
{'a', 'b', 'c', 'd'}
assert
collection
petl/test/transform/test_selects.py
test_facet
302
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import os import sys import pytest from petl.compat import izip_longest def eq_(expect, actual, msg=None): """Test when two values from a python variable are exactly equals (==)""" assert expect == actual, msg or ('%r != %s' % (expect, actual)...
first, abs=vabs)
pytest.approx
complex_expr
petl/test/helpers.py
assert_almost_equal
19
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from petl.compat import maxint from petl.test.helpers import eq_ from petl.util.parsers import numparser, datetimeparser def test_numparser_strict(): parsenumber = numparser(strict=True) assert parsenumber('1') == 1 assert parsenumber('1.0'...
maxint + 1
assert
complex_expr
petl/test/util/test_parsers.py
test_numparser_strict
25
null
petl-developers/petl
import random as pyrandom import time from functools import partial from petl.util.random import randomseed, randomtable, RandomTable, dummytable, DummyTable def test_randomtable(): """ Ensure that randomtable provides a table with the right number of rows and columns. """ columns, rows = 3, 10 ta...
rows + 1
assert
complex_expr
petl/test/util/test_random.py
test_randomtable
29
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.test.helpers import ieq from petl.errors import FieldSelectionError from petl.util import fieldnames from petl.transform.headers import setheader, extendheader, pushheader, skip, \ rename, prefixheader, suffixheader, sorthead...
('baz', 'quux')
assert
collection
petl/test/transform/test_headers.py
test_rename
203
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.errors import FieldSelectionError from petl.test.helpers import ieq from petl.transform.dedup import duplicates, unique, conflicts, distinct, \ isunique def test_duplicates_headerless_explicit(): table = [] with pyt...
FieldSelectionError)
pytest.raises
variable
petl/test/transform/test_dedup.py
test_duplicates_headerless_explicit
51
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from tempfile import NamedTemporaryFile import json from petl import fromjson, tojson from petl.test.helpers import ieq def test_tojson_1(): table = (('foo', 'bar'), ('a', 1), ('b', 2), ('c', 2)) f = Named...
1
assert
numeric_literal
petl/test/io/test_jsonl.py
test_tojson_1
67
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import json from tempfile import NamedTemporaryFile from petl.test.helpers import ieq from petl.io.json import tojson, fromjson def test_json_unicode(): tbl = ((u'id', u'name'), (1, u'Արամ Խաչատրյան'), (2, u'Johann Strauß'), ...
b['id']
assert
complex_expr
petl/test/io/test_json_unicode.py
test_json_unicode
27
null
petl-developers/petl
import random as pyrandom import time from functools import partial from petl.util.random import randomseed, randomtable, RandomTable, dummytable, DummyTable def test_randomtable(): """ Ensure that randomtable provides a table with the right number of rows and columns. """ columns, rows = 3, 10 ta...
columns
assert
variable
petl/test/util/test_random.py
test_randomtable
28
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from tempfile import NamedTemporaryFile import json from petl import fromjson, tojson from petl.test.helpers import ieq def test_tojson_2(): table = [['name', 'wins'], ['Gilbert', [['straight', '7S'], ['one pair', '10H']]], ...
'Gilbert'
assert
string_literal
petl/test/io/test_jsonl.py
test_tojson_2
86
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.errors import FieldSelectionError from petl.test.helpers import ieq, eq_ from petl.compat import PY3, next from petl.util.base import header, fieldnames, data, dicts, records, \ namedtuples, itervalues, values, rowgroupby, ex...
KeyError)
pytest.raises
variable
petl/test/util/test_base.py
test_expr_nok
343
null
petl-developers/petl
import pytest from petl.test.helpers import ieq, eq_ import petl.config as config def assert_failonerror(input_fn, expected_output): """In the input rows, the first row should process through the transformation cleanly. The second row should generate an exception. There are no requirements for any other...
Exception)
pytest.raises
variable
petl/test/failonerror.py
assert_failonerror
36
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from tempfile import NamedTemporaryFile import json from petl import fromjson, tojson from petl.test.helpers import ieq def test_tojson_2(): table = [['name', 'wins'], ['Gilbert', [['straight', '7S'], ['one pair', '10H']]], ...
'Alexa'
assert
string_literal
petl/test/io/test_jsonl.py
test_tojson_2
88
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.errors import FieldSelectionError from petl.test.helpers import ieq from petl.util import expr, empty, coalesce from petl.transform.basics import cut, cat, addfield, rowslice, head, tail, \ cutout, skipcomments, annex, addrow...
FieldSelectionError)
pytest.raises
variable
petl/test/transform/test_basics.py
test_cut_headerless
77
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.errors import FieldSelectionError from petl.test.helpers import ieq, eq_ from petl.comparison import Comparable from petl.transform.selects import select, selectin, selectcontains, \ rowlenselect, selectusingcontext, facet, s...
FieldSelectionError)
pytest.raises
variable
petl/test/transform/test_selects.py
test_fieldselect_headerless
127
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import sys from collections import OrderedDict from tempfile import NamedTemporaryFile import pytest from petl.test.helpers import ieq from petl.util import nrows, look from petl.io.xml import fromxml, toxml from petl.compat import urlopen def test_fr...
0
assert
numeric_literal
petl/test/io/test_xml.py
test_fromxml_url
209
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.errors import FieldSelectionError from petl.test.helpers import ieq, eq_ from petl.compat import PY3, next from petl.util.base import header, fieldnames, data, dicts, records, \ namedtuples, itervalues, values, rowgroupby, ex...
FieldSelectionError)
pytest.raises
variable
petl/test/util/test_base.py
test_itervalues_headerless
222
null
petl-developers/petl
import pytest from petl.io.db_create import make_sqlalchemy_column def test_json_inference(): data = [{'a': 1}, {'b': 2}, None] col = make_sqlalchemy_column(data, 'payload') assert col.name ==
'payload'
assert
string_literal
petl/test/io/test_db_inference.py
test_json_inference
15
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.errors import DuplicateKeyError, FieldSelectionError from petl.test.helpers import eq_ from petl import cut, lookup, lookupone, dictlookup, dictlookupone, \ recordlookup, recordlookupone def test_lookup_headerless(): tab...
FieldSelectionError)
pytest.raises
variable
petl/test/util/test_lookups.py
test_lookup_headerless
48
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from collections import OrderedDict from tempfile import NamedTemporaryFile import json import pytest from petl.test.helpers import ieq from petl import fromjson, fromdicts, tojson, tojsonarrays def dicts_generator(): def generator(): yiel...
('n', 'foo', 'bar')
assert
collection
petl/test/io/test_json.py
test_fromdicts_generator_random_access
256
null
petl-developers/petl
import random as pyrandom import time from functools import partial from petl.util.random import randomseed, randomtable, RandomTable, dummytable, DummyTable def test_dummytable_no_seed(): """ Ensure that dummytable provides a table with the right number of rows and columns when not provided with a seed. ...
3
assert
numeric_literal
petl/test/util/test_random.py
test_dummytable_no_seed
69
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from petl.compat import maxint from petl.test.helpers import eq_ from petl.util.parsers import numparser, datetimeparser def test_numparser(): parsenumber = numparser() assert parsenumber('1') == 1 assert parsenumber('1.0') == 1.0 asser...
'aaa'
assert
string_literal
petl/test/util/test_parsers.py
test_numparser
16
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from collections import OrderedDict from tempfile import NamedTemporaryFile import json import pytest from petl.test.helpers import ieq from petl import fromjson, fromdicts, tojson, tojsonarrays def dicts_generator(): def generator(): yiel...
second_row1
assert
variable
petl/test/io/test_json.py
test_fromdicts_generator_random_access
265
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import logging import pytest import petl as etl from petl.transform.validation import validate from petl.test.helpers import ieq from petl.errors import FieldSelectionError logger = logging.getLogger(__name__) debug = logger.debug def test_non_option...
FieldSelectionError)
pytest.raises
variable
petl/test/transform/test_validation.py
test_non_optional_constraint_with_missing_field
62
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from collections import OrderedDict from tempfile import NamedTemporaryFile import json import pytest from petl.test.helpers import ieq from petl import fromjson, fromdicts, tojson, tojsonarrays def test_tojson(): # exercise function table = ...
1
assert
numeric_literal
petl/test/io/test_json.py
test_tojson
161
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.errors import ArgumentError from petl.test.helpers import ieq from petl.transform.unpacks import unpack, unpackdict def test_unpack_headerless(): table = [] with pytest.raises(
ArgumentError)
pytest.raises
variable
petl/test/transform/test_unpacks.py
test_unpack_headerless
83
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.test.helpers import ieq from petl.errors import FieldSelectionError from petl.util import fieldnames from petl.transform.headers import setheader, extendheader, pushheader, skip, \ rename, prefixheader, suffixheader, sorthead...
FieldSelectionError)
pytest.raises
variable
petl/test/transform/test_headers.py
test_rename_headerless
248
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import os import sys import pytest from petl.compat import izip_longest def eq_(expect, actual, msg=None): """Test when two values from a python variable are exactly equals (==)""" assert expect ==
actual
assert
variable
petl/test/helpers.py
eq_
13
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest import petl as etl from petl.test.helpers import ieq, eq_, assert_almost_equal from petl.io.numpy import toarray, fromarray, torecarray def test_toarray_explicitdtype(): t = [('foo', 'bar', 'baz'), ('apples', 1, 2...
a['C'][1])
assert_*
complex_expr
petl/test/io/test_numpy.py
test_toarray_explicitdtype
135
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from collections import OrderedDict from tempfile import NamedTemporaryFile import json import pytest from petl.test.helpers import ieq from petl import fromjson, fromdicts, tojson, tojsonarrays def test_fromdicts_header_list(): data = [OrderedDic...
('foo', 'bar')
assert
collection
petl/test/io/test_json.py
test_fromdicts_header_list
201
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.errors import FieldSelectionError from petl.test.helpers import ieq, eq_ from petl.comparison import Comparable from petl.transform.selects import select, selectin, selectcontains, \ rowlenselect, selectusingcontext, facet, s...
{'aa', 'bb', 'cc', 'dd'}
assert
collection
petl/test/transform/test_selects.py
test_facet_2
325
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import os import sys import pytest from petl.compat import izip_longest def eq_(expect, actual, msg=None): """Test when two values from a python variable are exactly equals (==)""" assert expect == actual, msg or ('%r != %s' % (expect, actual)...
None
assert
none_literal
petl/test/helpers.py
_ieq_row
40
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import json from tempfile import NamedTemporaryFile from petl.test.helpers import ieq from petl.io.json import tojson, fromjson def test_json_unicode(): tbl = ((u'id', u'name'), (1, u'Արամ Խաչատրյան'), (2, u'Johann Strauß'), ...
b['name']
assert
complex_expr
petl/test/io/test_json_unicode.py
test_json_unicode
28
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from collections import OrderedDict from tempfile import NamedTemporaryFile import json import pytest from petl.test.helpers import ieq from petl import fromjson, fromdicts, tojson, tojsonarrays def dicts_generator(): def generator(): yiel...
first_row3
assert
variable
petl/test/io/test_json.py
test_fromdicts_generator_random_access
270
null
petl-developers/petl
from __future__ import division, print_function, absolute_import from datetime import datetime from tempfile import NamedTemporaryFile import pytest import petl as etl from petl.io.xls import fromxls, toxls from petl.test.helpers import ieq def _get_test_xls(): try: import pkg_resources return p...
kwargs
assert
variable
petl/test/io/test_xls.py
wrapper
127
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest import petl as etl from petl.test.helpers import ieq, eq_, assert_almost_equal from petl.io.numpy import toarray, fromarray, torecarray def test_toarray_nodtype(): t = [('foo', 'bar', 'baz'), ('apples', 1, 2.5), ...
a['baz'][0])
assert_*
complex_expr
petl/test/io/test_numpy.py
test_toarray_nodtype
34
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from petl.compat import maxint from petl.test.helpers import eq_ from petl.util.parsers import numparser, datetimeparser def test_numparser(): parsenumber = numparser() assert parsenumber('1') == 1 assert parsenumber('1.0') == 1.0 asser...
None
assert
none_literal
petl/test/util/test_parsers.py
test_numparser
17
null
petl-developers/petl
import random as pyrandom import time from functools import partial from petl.util.random import randomseed, randomtable, RandomTable, dummytable, DummyTable def test_dummytable_custom_fields(): """ Ensure that dummytable provides a table with the right number of rows and that it accepts and uses custom c...
('count', 'pet', 'color', 'value')
assert
collection
petl/test/util/test_random.py
test_dummytable_custom_fields
57
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest from petl.errors import FieldSelectionError from petl.test.failonerror import assert_failonerror from petl.test.helpers import ieq from petl.transform.conversions import convert, convertall, convertnumbers, \ replace, update, format, i...
FieldSelectionError)
pytest.raises
variable
petl/test/transform/test_conversions.py
test_convert_headerless
79
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import pytest import petl as etl from petl.test.helpers import ieq, eq_, assert_almost_equal from petl.io.numpy import toarray, fromarray, torecarray def test_toarray_explicitdtype(): t = [('foo', 'bar', 'baz'), ('apples', 1, 2...
a['C'][2])
assert_*
complex_expr
petl/test/io/test_numpy.py
test_toarray_explicitdtype
136
null
petl-developers/petl
from __future__ import absolute_import, print_function, division import gzip import bz2 import zipfile from tempfile import NamedTemporaryFile from petl.compat import PY2 from petl.test.helpers import ieq, eq_ import petl as etl from petl.io.sources import MemorySource, PopenSource, ZipSource, \ StdoutSource, Gzi...
( 'foo,bar\r\na,1\r\nb,2\r\n' , 'foo,bar\na,1\nb,2\n' )
assert
collection
petl/test/io/test_sources.py
test_stdoutsource_none
103
null
petl-developers/petl
from __future__ import absolute_import, print_function, division from tempfile import NamedTemporaryFile import json from petl import fromjson, tojson from petl.test.helpers import ieq def test_tojson_1(): table = (('foo', 'bar'), ('a', 1), ('b', 2), ('c', 2)) f = Named...
2
assert
numeric_literal
petl/test/io/test_jsonl.py
test_tojson_1
69
null
SALib/SALib
import os from os.path import join as pth_join import subprocess salib_cli = "salib" ishigami_fp = "./src/SALib/test_functions/params/Ishigami.txt" test_file = "test.txt" test_data = pth_join("./tests", "data", test_file) def teardown_function(func): # Removes the test file if it was created. files = os.listd...
0
assert
numeric_literal
tests/test_cli_sample.py
test_ff
30
null
SALib/SALib
import pytest import copy import numpy as np import pandas as pd from SALib import ProblemSpec from SALib.test_functions import Ishigami def test_sp_bounds(): """Ensure incorrect user-defined bounds raises AssertionErrors.""" with pytest.raises(
AssertionError)
pytest.raises
variable
tests/test_problem_spec.py
test_sp_bounds
13
null
SALib/SALib
from pytest import raises, fixture import numpy as np from numpy.testing import assert_allclose, assert_equal from SALib.analyze.morris import ( analyze, _compute_mu_star_confidence, _compute_elementary_effects, _reorganize_output_matrix, _compute_grouped_metric, _compute_grouped_sigma, _c...
expected)
assert_*
variable
tests/test_analyze_morris.py
test_compute_mu_star_confidence
32
null
SALib/SALib
from SALib.analyze import delta from SALib.util import handle_seed import numpy as np import pandas as pd import pytest def create_base_dataframe(seed=42): rng = handle_seed(seed) n = 15000 col_a = np.linspace(10, 80, n, endpoint=False) + rng.uniform(0, 70 / n, size=n) col_b = np.linspace(-20, 50, n, ...
RuntimeError, match=r"Input X and output Y")
pytest.raises
complex_expr
tests/test_analyze_delta.py
test_samplesize_mismatch
210
null
SALib/SALib
from pytest import raises from numpy.testing import assert_allclose import numpy as np from SALib.test_functions.Sobol_G import ( evaluate, _total_variance, _partial_first_order_variance, sensitivity_index, total_sensitivity_index, ) from SALib import ProblemSpec def test_partial_first_order_var...
expected)
assert_*
variable
tests/test_test_functions.py
test_partial_first_order_variance
81
null
SALib/SALib
from pytest import raises from numpy.testing import assert_equal, assert_allclose import numpy as np from scipy import stats import pytest from SALib.util import ( read_param_file, _scale_samples, _unscale_samples, compute_groups_matrix, ) from SALib.sample import latin def setup_param_file_group_dis...
expected)
assert_*
variable
tests/test_util.py
test_nonuniform_scale_samples_truncnorm
206
null
SALib/SALib
from pytest import raises, mark from numpy.testing import assert_equal, assert_allclose import numpy as np from scipy.stats import norm from SALib.analyze import sobol from SALib.sample.sobol import sample as sobol_sample from SALib.sample import sobol_sequence from SALib.test_functions import Ishigami, Sobol_G from S...
[N * (D + 2), D])
assert_*
collection
tests/test_sp_sobol.py
test_sample_size_first_order
51
null
SALib/SALib
from SALib.sample.latin import sample from pytest import approx import numpy as np class TestLatinSample: def test_latin_sample_trivial(self): problem = {"num_vars": 1, "bounds": [[0, 1]], "names": ["var1"]} actual = sample(problem, 10, seed=42) expected = np.array( [ ...
expected)
assert_*
variable
tests/sample/test_latin.py
test_latin_sample_trivial
TestLatinSample
25
null
SALib/SALib
from numpy.testing import assert_equal, assert_allclose from pytest import raises, fixture, warns, mark import numpy as np import warnings from SALib.sample.morris.morris import ( sample, _check_group_membership, _check_if_num_levels_is_even, _compute_optimised_trajectories, _generate_p_star, ...
result
assert
variable
tests/sample/morris/test_morris.py
test_define_problem_with_groups_all_ok
TestGroupSampleGeneration
258
null
SALib/SALib
import pytest import numpy as np from SALib import ProblemSpec def example_func(x): """Example linear test function.""" return np.sum(x, axis=1) def test_morris_group_analysis(): r"""Ensure valid groupings are returned from the Morris analysis method. Note: $\mu$ and $\sigma$ values will be NaN. See...
3
assert
numeric_literal
tests/test_groups.py
test_morris_group_analysis
81
null
SALib/SALib
from pytest import raises from numpy.testing import assert_equal, assert_allclose import numpy as np from scipy import stats import pytest from SALib.util import ( read_param_file, _scale_samples, _unscale_samples, compute_groups_matrix, ) from SALib.sample import latin def setup_param_file_group_dis...
["Test 1", "Test 2"])
assert_*
collection
tests/test_util.py
test_csv_readfile_with_whitespace
92
null
SALib/SALib
from numpy.testing import assert_equal, assert_allclose from pytest import raises, fixture, warns, mark import numpy as np import warnings from SALib.sample.morris.morris import ( sample, _check_group_membership, _check_if_num_levels_is_even, _compute_optimised_trajectories, _generate_p_star, ...
["Group 1", "Group 2"])
assert_*
collection
tests/sample/morris/test_morris.py
test_group_in_param_file_read
97
null
SALib/SALib
import numpy as np import pandas as pd from SALib.sample import ( sobol as sobol_sample, morris as morris_sample, finite_diff, fast_sampler, ff as ff_sample, latin, ) from SALib.analyze import sobol, morris, dgsm, fast, ff, rbd_fast from SALib.test_functions import Ishigami, Sobol_G def test_ff...
set( main_index )
assert
func_call
tests/test_to_df.py
test_ff_to_df
182
null