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
pyparsing/pyparsing
import random from typing import Union, Iterable import pytest import pyparsing as pp @pytest.mark.parametrize( "test_label, input_list, expected_output", [ ("Empty list", [], []), ("Flat list", [1, 2, 3], [1, 2, 3]), ("Nested list", [[1, 2], [3, 4]], [1, 2, 3, 4]), ("Mixed list...
expected_output
assert
variable
tests/test_util.py
test_flatten
50
null
pyparsing/pyparsing
import unittest from pyparsing import ParseException from .btpyparse import Macro from . import btpyparse as bp class TestBibparse(unittest.TestCase): def test_bib1(self): # First pass whole bib-like tests txt = """ Some introductory text (implicit comment) @ARTICLE{Brett2002marsb...
res3)
self.assertEqual
variable
examples/test_bibparse.py
test_bib1
TestBibparse
228
null
pyparsing/pyparsing
import pyparsing as pp import pytest from examples.tiny.tiny_parser import parse_tiny def test_parse_if_then_elseif_else(): src = ( "int main(){ if x < 10 then y := y + 1; write y; elseif x = 0 then write 0; else read x; end return 0; }" ) res = parse_tiny(src) ifres = res.program.main.body.st...
2
assert
numeric_literal
examples/tiny/tests/test_tiny.py
test_parse_if_then_elseif_else
29
null
pyparsing/pyparsing
from pyparsing.tools.cvt_pyparsing_pep8_names import ( pep8_converter, pre_pep8_arg_names, pre_pep8_method_names, special_changes, special_changes_arg_names ) import pytest def test_conversion_composed(): # testing for these in their own test cases below special_changes_copy = {**special_changes} speci...
expected
assert
variable
tests/test_pep8_converter.py
test_conversion_composed
140
null
pyparsing/pyparsing
from __future__ import annotations import textwrap import pyparsing as pp import pytest from examples.tiny.tiny_parser import parse_tiny from examples.tiny.tiny_ast import TinyNode from examples.tiny.tiny_engine import TinyEngine def _run_main_and_capture(src: str, capsys: pytest.CaptureFixture[str]) -> tuple[int |...
2
assert
numeric_literal
examples/tiny/tests/test_tiny_ast_nodes.py
test_return_inside_if_elseif_branch
349
null
pyparsing/pyparsing
def testOptionalBeyondEndOfString(self): print("verify handling of Optional's beyond the end of string") testGrammar = "A" + pp.Optional("B") + pp.Optional("C") + pp.Optional("D") testGrammar.parse_string("A", parse_all=True) testGrammar.parse_string("AB", parse_all=True) def te...
2)
self.assertEqual
numeric_literal
tests/test_unit.py
testForwardsDoProperStreamlining
Test02_WithoutPackrat
10,966
null
pyparsing/pyparsing
import unittest from pyparsing import ParseException from .btpyparse import Macro from . import btpyparse as bp class TestBibparse(unittest.TestCase): def test_parse_string(self): # test string building blocks self.assertEqual(bp.chars_no_quotecurly.parse_string("x")[0],
"x")
self.assertEqual
string_literal
examples/test_bibparse.py
test_parse_string
TestBibparse
48
null
pyparsing/pyparsing
def testQuotedStringLoc(self): expr = pp.QuotedString("'") expr.add_parse_action(lambda t: t[0].upper()) test_string = "Using 'quotes' for 'sarcasm' or 'emphasis' is not good 'style'." transformed = expr.transform_string(test_string) print(test_string) print(transfo...
None)
self.assertEqual
none_literal
tests/test_unit.py
testRegexDeferredCompile
Test02_WithoutPackrat
4,259
null
pyparsing/pyparsing
import pytest import warnings from pyparsing import Word, nums, ParserElement, original_text_for, sgl_quoted_string def test_withClass_emits_DeprecationWarning(): div, _ = make_html_tags("div") with pytest.warns(DeprecationWarning, match="'withClass' deprecated - use 'with_class'"): start = div().set_...
"div"
assert
string_literal
tests/test_pre_pep8_deprecation_warnings.py
test_withClass_emits_DeprecationWarning
354
null
pyparsing/pyparsing
import pytest import warnings from pyparsing import Word, nums, ParserElement, original_text_for, sgl_quoted_string def test_scan_string_maxMatches_kwarg_emits_DeprecationWarning(): parser = Word(nums) with pytest.warns(DeprecationWarning, match="'maxMatches' argument is deprecated, use 'max_matches'"): ...
2
assert
numeric_literal
tests/test_pre_pep8_deprecation_warnings.py
test_scan_string_maxMatches_kwarg_emits_DeprecationWarning
95
null
pyparsing/pyparsing
import random from typing import Union, Iterable import pytest import pyparsing as pp def test_make_compressed_re_bad_input(): from pyparsing.util import make_compressed_re with pytest.raises(
ValueError)
pytest.raises
variable
tests/test_util.py
test_make_compressed_re_bad_input
202
null
pyparsing/pyparsing
from __future__ import annotations import textwrap import pyparsing as pp import pytest from examples.tiny.tiny_parser import parse_tiny from examples.tiny.tiny_ast import TinyNode from examples.tiny.tiny_engine import TinyEngine def _run_main_and_capture(src: str, capsys: pytest.CaptureFixture[str]) -> tuple[int |...
1
assert
numeric_literal
examples/tiny/tests/test_tiny_ast_nodes.py
test_return_inside_if_then_branch
324
null
pyparsing/pyparsing
import pytest import warnings from pyparsing import Word, nums, ParserElement, original_text_for, sgl_quoted_string def test_common_upcaseTokens_emits_DeprecationWarning(): parser = Word("abc").set_parse_action(pp.common.upcaseTokens) with pytest.warns(DeprecationWarning, match="'upcaseTokens' deprecated - us...
"ABCA"
assert
string_literal
tests/test_pre_pep8_deprecation_warnings.py
test_common_upcaseTokens_emits_DeprecationWarning
430
null
pyparsing/pyparsing
import unittest from io import StringIO from pathlib import Path from typing import List from examples.jsonParser import jsonObject from examples.simpleBool import boolExpr from examples.simpleSQL import simpleSQL from examples.mozillaCalendarParser import calendars from pyparsing.diagram import to_railroad, railroad_...
expected_rr_len
assert
variable
tests/test_diagram.py
test_example_rr_diags
TestRailroadDiagrams
103
null
pyparsing/pyparsing
import platform import re import pytest @pytest.mark.skipif("mpl_mathtext is None") def test_get_unicode_index_exception(): with pytest.raises(
ValueError)
pytest.raises
variable
tests/test_matplotlib_cases.py
test_get_unicode_index_exception
87
null
pyparsing/pyparsing
import pytest import warnings from pyparsing import Word, nums, ParserElement, original_text_for, sgl_quoted_string def test_common_downcaseTokens_emits_DeprecationWarning(): parser = Word("ABC").set_parse_action(pp.common.downcaseTokens) with pytest.warns(DeprecationWarning, match="'downcaseTokens' deprecate...
"abca"
assert
string_literal
tests/test_pre_pep8_deprecation_warnings.py
test_common_downcaseTokens_emits_DeprecationWarning
437
null
pyparsing/pyparsing
import unittest from . import antlr_grammar class Test(unittest.TestCase): def testOptionsSpec(self): text = """options { language = Python; }""" antlr_grammar.optionsSpec.parse_string(text) # @UndefinedVariable def testTokensSpec(self): ...
[ [ [["2"], []], [ ["-", [["5"], [["*", ["4", "2"]]]]], ["+", [["7"], [["/", ["2", "5"]]]]], ], ] ])
self.assertEqual
collection
examples/antlr_grammar_tests.py
testGrammar
Test
86
null
pyparsing/pyparsing
from contextlib import contextmanager import re import typing import unittest from .core import ( ParserElement, ParseException, Keyword, __diag__, __compat__, ) from . import core_builtin_exprs class TestParseResultsAsserts(unittest.TestCase): def assertParseResultsEquals( ...
result.as_list())
self.assertEqual
func_call
pyparsing/testing.py
assertParseResultsEquals
TestParseResultsAsserts
158
null
pyparsing/pyparsing
expected_list=exp, msg=f"Failed test, expected {expected}, got {result.as_list()}", ) def testNestedExpressions(self): """ This unit test checks nested_expr in these ways: - use of default arguments - use of non-default arguments (such as ...
set()
assert
func_call
tests/test_unit.py
testWordExclude2
Test02_WithoutPackrat
5,831
null
pyparsing/pyparsing
import pyparsing as pp import pytest from examples.tiny.tiny_parser import parse_tiny def test_repeat_until_with_c_style_comment(): src = "int main(){ repeat /*loop*/ x := x - 1; write x; until x = 0 return 0; }" res = parse_tiny(src) rpt = res.program.main.body.stmts[0] assert rpt.type == "repeat_stm...
"="
assert
string_literal
examples/tiny/tests/test_tiny.py
test_repeat_until_with_c_style_comment
43
null
pyparsing/pyparsing
import pyparsing as pp import pytest from examples.tiny.tiny_parser import parse_tiny def test_parse_assign_read_write_in_main(): src = "int main(){ read x; y := 42; write y; return 0; }" res = parse_tiny(src) assert "program" in res main = res.program.main stmts = main.body.stmts assert len(...
4
assert
numeric_literal
examples/tiny/tests/test_tiny.py
test_parse_assign_read_write_in_main
13
null
pyparsing/pyparsing
import collections import contextlib import datetime import random import re import shlex import sys import sysconfig import warnings from types import SimpleNamespace from io import StringIO from textwrap import dedent from typing import Any import unittest from unittest.mock import patch, mock_open import subprocess ...
4)
self.assertLessEqual
numeric_literal
tests/test_unit.py
test000_assert_packrat_status
Test10_WithLeftRecursionParsingBoundedMemo
11,247
null
pyparsing/pyparsing
import pyparsing as pp import pytest from examples.tiny.tiny_parser import parse_tiny def test_repeat_until_with_c_style_comment(): src = "int main(){ repeat /*loop*/ x := x - 1; write x; until x = 0 return 0; }" res = parse_tiny(src) rpt = res.program.main.body.stmts[0] assert rpt.type ==
"repeat_stmt"
assert
string_literal
examples/tiny/tests/test_tiny.py
test_repeat_until_with_c_style_comment
40
null
pyparsing/pyparsing
import collections import contextlib import datetime import random import re import shlex import sys import sysconfig import warnings from types import SimpleNamespace from io import StringIO from textwrap import dedent from typing import Any import unittest from unittest.mock import patch, mock_open import subprocess ...
ans)
self.assertIsNone
variable
tests/test_unit.py
test
Test02_WithoutPackrat
577
null
pyparsing/pyparsing
import collections import contextlib import datetime import random import re import shlex import sys import sysconfig import warnings from types import SimpleNamespace from io import StringIO from textwrap import dedent from typing import Any import unittest from unittest.mock import patch, mock_open import subprocess ...
-4)
self.assertEqual
numeric_literal
tests/test_unit.py
test_add_sub
Test11_LR1_Recursion
11,328
null
pyparsing/pyparsing
import pyparsing as pp import pytest from examples.tiny.tiny_parser import parse_tiny def test_parse_if_then_elseif_else(): src = ( "int main(){ if x < 10 then y := y + 1; write y; elseif x = 0 then write 0; else read x; end return 0; }" ) res = parse_tiny(src) ifres = res.program.main.body.st...
"if_stmt"
assert
string_literal
examples/tiny/tests/test_tiny.py
test_parse_if_then_elseif_else
27
null
pyparsing/pyparsing
import pytest import warnings from pyparsing import Word, nums, ParserElement, original_text_for, sgl_quoted_string def test_withAttribute_emits_DeprecationWarning(): # withAttribute should warn and validate attribute presence/value div, div_end = make_html_tags("div") with pytest.warns(DeprecationWarning...
"grid"
assert
string_literal
tests/test_pre_pep8_deprecation_warnings.py
test_withAttribute_emits_DeprecationWarning
346
null
pyparsing/pyparsing
import pyparsing as pp import pytest from examples.tiny.tiny_parser import parse_tiny def test_parse_if_then_elseif_else(): src = ( "int main(){ if x < 10 then y := y + 1; write y; elseif x = 0 then write 0; else read x; end return 0; }" ) res = parse_tiny(src) ifres = res.program.main.body.st...
1
assert
numeric_literal
examples/tiny/tests/test_tiny.py
test_parse_if_then_elseif_else
33
null
pyparsing/pyparsing
import pytest import warnings from pyparsing import Word, nums, ParserElement, original_text_for, sgl_quoted_string def test_replaceWith_emits_DeprecationWarning(): # replaceWith should warn and still function as a parse action factory from pyparsing import Word, nums parser = Word(nums) with pytest....
[0]
assert
collection
tests/test_pre_pep8_deprecation_warnings.py
test_replaceWith_emits_DeprecationWarning
326
null
pyparsing/pyparsing
import unittest from pyparsing import ParseException from .btpyparse import Macro from . import btpyparse as bp class TestBibparse(unittest.TestCase): def test_parse_string(self): # test string building blocks self.assertEqual(bp.chars_no_quotecurly.parse_string("x")[0], "x") self.assertEq...
[])
self.assertEqual
collection
examples/test_bibparse.py
test_parse_string
TestBibparse
57
null
pyparsing/pyparsing
import unittest from io import StringIO from pathlib import Path from typing import List from examples.jsonParser import jsonObject from examples.simpleBool import boolExpr from examples.simpleSQL import simpleSQL from examples.mozillaCalendarParser import calendars from pyparsing.diagram import to_railroad, railroad_...
1
assert
numeric_literal
tests/test_diagram.py
test_nested_forward_with_inner_name_only
TestRailroadDiagrams
135
null
pyparsing/pyparsing
import pyparsing as pp import pytest from examples.tiny.tiny_parser import parse_tiny def test_parse_assign_read_write_in_main(): src = "int main(){ read x; y := 42; write y; return 0; }" res = parse_tiny(src) assert "program" in res main = res.program.main stmts = main.body.stmts assert len(s...
"write_stmt"
assert
string_literal
examples/tiny/tests/test_tiny.py
test_parse_assign_read_write_in_main
17
null
pyparsing/pyparsing
import random from typing import Union, Iterable import pytest import pyparsing as pp def test_html_entities() -> None: import html.entities from pyparsing import common_html_entity # create test string from all known HTML5 entities, in random order entity_strings = [f'&{e.rstrip(";")};' for e in html...
len(html.entities.html5)
assert
func_call
tests/test_util.py
test_html_entities
186
null
pyparsing/pyparsing
import unittest from pyparsing import ParseException from .btpyparse import Macro from . import btpyparse as bp class TestBibparse(unittest.TestCase): def test_bib1(self): # First pass whole bib-like tests txt = """ Some introductory text (implicit comment) @ARTICLE{Brett2002marsb...
3)
self.assertEqual
numeric_literal
examples/test_bibparse.py
test_bib1
TestBibparse
224
null
pyparsing/pyparsing
from __future__ import annotations import textwrap import pyparsing as pp import pytest from examples.tiny.tiny_parser import parse_tiny from examples.tiny.tiny_ast import TinyNode from examples.tiny.tiny_engine import TinyEngine def _run_main_and_capture(src: str, capsys: pytest.CaptureFixture[str]) -> tuple[int |...
5
assert
numeric_literal
examples/tiny/tests/test_tiny_ast_nodes.py
test_repeat_until_prints_n_times
163
null
pyparsing/pyparsing
import textwrap import pytest import pyparsing as pp ppt = pp.testing TAB = chr(9) @pytest.mark.parametrize( "source, options, expected", [ # simple call to with_line_numbers ("abcd", {}, textwrap.dedent( """\ 1 1234567890 ...
expected
assert
variable
tests/test_testing.py
test_with_line_numbers
105
null
pyparsing/pyparsing
import platform import re import pytest @pytest.mark.parametrize( "math, msg", [ (r"$\hspace{}$", r"Expected \hspace{space}"), (r"$\hspace{foo}$", r"Expected \hspace{space}"), (r"$\sinx$", r"Unknown symbol: \sinx"), (r"$\dotx$", r"Unknown symbol: \dotx"), (r"$\frac$", r...
ValueError, match=match)
pytest.raises
complex_expr
tests/test_matplotlib_cases.py
test_mathtext_exceptions
80
null
pyparsing/pyparsing
import unittest from io import StringIO from pathlib import Path from typing import List from examples.jsonParser import jsonObject from examples.simpleBool import boolExpr from examples.simpleSQL import simpleSQL from examples.mozillaCalendarParser import calendars from pyparsing.diagram import to_railroad, railroad_...
None
assert
none_literal
tests/test_diagram.py
test_none_name
TestRailroadDiagrams
159
null
pyparsing/pyparsing
import pytest import warnings from pyparsing import Word, nums, ParserElement, original_text_for, sgl_quoted_string def test_setResultsName_emits_DeprecationWarning(): parser = Word(nums) with pytest.warns(DeprecationWarning, match="'setResultsName' deprecated - use 'set_results_name'"): p2 = parser.s...
parser
assert
variable
tests/test_pre_pep8_deprecation_warnings.py
test_setResultsName_emits_DeprecationWarning
51
null
pyparsing/pyparsing
import random from typing import Union, Iterable import pytest import pyparsing as pp def test_make_compressed_re_bad_input(): from pyparsing.util import make_compressed_re with pytest.raises(ValueError): make_compressed_re([]) with pytest.raises(ValueError): make_compressed_re(["a", "", ...
make_compressed_re(["a", "b", "c", "a"])
assert
func_call
tests/test_util.py
test_make_compressed_re_bad_input
209
null
pyparsing/pyparsing
import pytest import warnings from pyparsing import Word, nums, ParserElement, original_text_for, sgl_quoted_string def test_addParseAction_emits_DeprecationWarning(): parser = Word(nums) with pytest.warns(DeprecationWarning, match="'addParseAction' deprecated - use 'add_parse_action'"): parser.addPar...
"7"
assert
string_literal
tests/test_pre_pep8_deprecation_warnings.py
test_addParseAction_emits_DeprecationWarning
74
null
pyparsing/pyparsing
import unittest from io import StringIO from pathlib import Path from typing import List from examples.jsonParser import jsonObject from examples.simpleBool import boolExpr from examples.simpleSQL import simpleSQL from examples.mozillaCalendarParser import calendars from pyparsing.diagram import to_railroad, railroad_...
3
assert
numeric_literal
tests/test_diagram.py
test_create_diagram_for_oneormore_with_stopon
TestRailroadDiagrams
209
null
pyparsing/pyparsing
from __future__ import annotations import textwrap import pyparsing as pp import pytest from examples.tiny.tiny_parser import parse_tiny from examples.tiny.tiny_ast import TinyNode from examples.tiny.tiny_engine import TinyEngine def _run_main_and_capture(src: str, capsys: pytest.CaptureFixture[str]) -> tuple[int |...
0
assert
numeric_literal
examples/tiny/tests/test_tiny_ast_nodes.py
test_declaration_with_initializers_prints_values
49
null
pyparsing/pyparsing
import pyparsing as pp import pytest from examples.tiny.tiny_parser import parse_tiny def test_parse_assign_read_write_in_main(): src = "int main(){ read x; y := 42; write y; return 0; }" res = parse_tiny(src) assert "program" in res main = res.program.main stmts = main.body.stmts assert len(s...
"y"
assert
string_literal
examples/tiny/tests/test_tiny.py
test_parse_assign_read_write_in_main
16
null
pyparsing/pyparsing
import pytest import warnings from pyparsing import Word, nums, ParserElement, original_text_for, sgl_quoted_string def test_removeQuotes_emits_DeprecationWarning(): # removeQuotes should warn and strip quotes from quoted_string from pyparsing import Regex qs = Regex(r"'[^']*'") with pytest.warns(Depr...
"abc"
assert
string_literal
tests/test_pre_pep8_deprecation_warnings.py
test_removeQuotes_emits_DeprecationWarning
336
null
pyparsing/pyparsing
import pyparsing as pp import pytest from examples.tiny.tiny_parser import parse_tiny def test_parse_all_required(): # extra trailing garbage should fail when parse_all=True with pytest.raises(
pp.ParseException)
pytest.raises
complex_expr
examples/tiny/tests/test_tiny.py
test_parse_all_required
48
null
AndrewAnnex/SpiceyPy
import os import time import timeit import itertools import pytest from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKernels, cleanup_cassini_kernels, cleanup_extra_kernels, cleanup_core_kernels, cwd, ) import numpy as np import numpy.testi...
10
assert
numeric_literal
src/spiceypy/benchmarks/test_cyice.py
test_getelm
618
null
AndrewAnnex/SpiceyPy
import os import time import platform import tempfile import urllib import urllib.error import urllib.request import sys import hashlib cwd = "/tmp" if platform.system() == "Darwin" else tempfile.gettempdir() def get_kernel_name_from_url(url: str) -> str: return url.split("/")[-1] def get_path_from_url(url: str)...
None
assert
none_literal
src/spiceypy/tests/gettestkernels.py
attempt_download
202
null
AndrewAnnex/SpiceyPy
import spiceypy as spice from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, ) import pytest def setup_module(module): download_kernels() @pytest.mark.parametrize( ["expected_len", "kernel_list"], [ (1, CoreKernels.lsk), (len(CoreKernels.standardKernelList) +...
expected_len
assert
variable
src/spiceypy/tests/test_context_manager.py
test_unload_if_error
113
null
AndrewAnnex/SpiceyPy
import spiceypy as spice from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, ) import pytest def setup_module(module): download_kernels() @pytest.mark.parametrize( ["local_len", "global_len", "local_kernels", "global_kernels"], [ (1, 1, [CoreKernels.lsk], [CoreKernel...
local_len
assert
variable
src/spiceypy/tests/test_context_manager.py
test_side_effect
71
null
AndrewAnnex/SpiceyPy
import pytest import spiceypy as spice from spiceypy.cyice import cyice import spiceypy.found_catcher from spiceypy.tests.gettestkernels import cwd, CoreKernels, ExtraKernels import os def test_error_to_str(): try: spice.bodc2n(-9991) except spice.exceptions.SpiceyError as sp: assert str(sp) !...
""
assert
string_literal
src/spiceypy/tests/test_spiceerrors.py
test_error_to_str
150
null
AndrewAnnex/SpiceyPy
import pytest import spiceypy as spice from spiceypy.cyice import cyice import spiceypy.found_catcher from spiceypy.tests.gettestkernels import cwd, CoreKernels, ExtraKernels import os def test_geterror(): spice.setmsg("some error occured") spice.sigerr("error") assert spice.failed() assert spice.getm...
"error"
assert
string_literal
src/spiceypy/tests/test_spiceerrors.py
test_geterror
41
null
AndrewAnnex/SpiceyPy
import pytest import spiceypy as spice import pandas as pd import numpy as np import numpy.testing as npt import os import warnings from datetime import datetime, timezone import spiceypy.utils.callbacks from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKer...
3
assert
numeric_literal
src/spiceypy/tests/test_wrapper.py
test_bodvcd
332
null
AndrewAnnex/SpiceyPy
import spiceypy as spice from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, ) import pytest def setup_module(module): download_kernels() @pytest.mark.parametrize( ["expected_length", "kernel_list"], [ (1, CoreKernels.lsk), (len(CoreKernels.standardKernelList...
expected_length
assert
variable
src/spiceypy/tests/test_context_manager.py
test_input_types
32
null
AndrewAnnex/SpiceyPy
import spiceypy as spice import spiceypy.utils.support_types as stypes import pytest import ctypes import numpy as np import numpy.testing as npt import array def test_to_double_matrix(): made_from_list = stypes.to_double_matrix([[1.0, 2.0], [3.0, 4.0]]) assert len(made_from_list) ==
2
assert
numeric_literal
src/spiceypy/tests/test_support_types.py
test_to_double_matrix
183
null
AndrewAnnex/SpiceyPy
import os import time import timeit import itertools import pytest from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKernels, cleanup_cassini_kernels, cleanup_extra_kernels, cleanup_core_kernels, cwd, ) import numpy as np import numpy.testi...
11
assert
numeric_literal
src/spiceypy/benchmarks/test_cyice.py
test_et2lst
398
null
AndrewAnnex/SpiceyPy
import os import time import timeit import itertools import pytest from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKernels, cleanup_cassini_kernels, cleanup_extra_kernels, cleanup_core_kernels, cwd, ) import numpy as np import numpy.testi...
np.bool
assert
complex_expr
src/spiceypy/benchmarks/test_cyice.py
test_fovray_v
549
null
AndrewAnnex/SpiceyPy
import spiceypy as spice import spiceypy.utils.support_types as stypes import pytest import ctypes import numpy as np import numpy.testing as npt import array def test_spicecell_len0(): test_cell = stypes.SPICEINT_CELL(8) assert len(test_cell)==
0
assert
numeric_literal
src/spiceypy/tests/test_support_types.py
test_spicecell_len0
84
null
AndrewAnnex/SpiceyPy
import pytest import spiceypy as spice from spiceypy.cyice import cyice import spiceypy.found_catcher from spiceypy.tests.gettestkernels import cwd, CoreKernels, ExtraKernels import os def test_no_loaded_files_exception(): with pytest.raises(spice.SpiceyError): spice.ckgp(0, 0, 0, "blah") spice.reset()...
spice.SpiceyPyIOError)
pytest.raises
complex_expr
src/spiceypy/tests/test_spiceerrors.py
test_no_loaded_files_exception
120
null
AndrewAnnex/SpiceyPy
import os import time import timeit import itertools import pytest from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKernels, cleanup_cassini_kernels, cleanup_extra_kernels, cleanup_core_kernels, cwd, ) import numpy as np import numpy.testi...
22
assert
numeric_literal
src/spiceypy/benchmarks/test_cyice.py
test_et2lst
400
null
AndrewAnnex/SpiceyPy
import os import time import timeit import itertools import pytest from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKernels, cleanup_cassini_kernels, cleanup_extra_kernels, cleanup_core_kernels, cwd, ) import numpy as np import numpy.testi...
2
assert
numeric_literal
src/spiceypy/benchmarks/test_cyice.py
test_occult
981
null
AndrewAnnex/SpiceyPy
import os import time import timeit import itertools import pytest from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKernels, cleanup_cassini_kernels, cleanup_extra_kernels, cleanup_core_kernels, cwd, ) import numpy as np import numpy.testi...
3
assert
numeric_literal
src/spiceypy/benchmarks/test_cyice.py
test_limbpt
901
null
AndrewAnnex/SpiceyPy
import spiceypy as spice import spiceypy.utils.support_types as stypes import pytest import ctypes import numpy as np import numpy.testing as npt import array def test_spicecell_equality(): c1 = stypes.Cell_Int(8) spice.appndi([1, 2, 3], c1) c2 = stypes.Cell_Int(8) spice.appndi([1, 2, 3], c2) c3 = ...
1
assert
numeric_literal
src/spiceypy/tests/test_support_types.py
test_spicecell_equality
102
null
AndrewAnnex/SpiceyPy
import pytest import spiceypy as spice from spiceypy.cyice import cyice import spiceypy.found_catcher from spiceypy.tests.gettestkernels import cwd, CoreKernels, ExtraKernels import os def test_get_spiceypy_exceptions(): with
( spice.exceptions.SpiceyError, spice.exceptions.SpiceyPyError, spice.exceptions.SpiceyPyIOError, ))
pytest.raises
collection
src/spiceypy/tests/test_spiceerrors.py
test_get_spiceypy_exceptions
56
null
AndrewAnnex/SpiceyPy
import spiceypy as spice import spiceypy.utils.support_types as stypes import pytest import ctypes import numpy as np import numpy.testing as npt import array def test_SpiceCell(): test_cell = stypes.SPICEINT_CELL(8) spice.appndi(1, test_cell) spice.appndi(2, test_cell) spice.appndi(3, test_cell) a...
3
assert
numeric_literal
src/spiceypy/tests/test_support_types.py
test_SpiceCell
65
null
AndrewAnnex/SpiceyPy
import spiceypy as spice from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, ) import pytest def setup_module(module): download_kernels() @pytest.mark.parametrize( ["expected_len", "kernel_list"], [ (1, CoreKernels.lsk), (len(CoreKernels.standardKernelList) +...
spice.utils.exceptions.SpiceyPyRuntimeError, match="Error in user code")
pytest.raises
complex_expr
src/spiceypy/tests/test_context_manager.py
test_unload_if_error
109
null
AndrewAnnex/SpiceyPy
import spiceypy as spice import spiceypy.utils.support_types as stypes import pytest import ctypes import numpy as np import numpy.testing as npt import array def test_spicecell_equality(): c1 = stypes.Cell_Int(8) spice.appndi([1, 2, 3], c1) c2 = stypes.Cell_Int(8) spice.appndi([1, 2, 3], c2) c3 = ...
c2
assert
variable
src/spiceypy/tests/test_support_types.py
test_spicecell_equality
103
null
AndrewAnnex/SpiceyPy
import spiceypy as spice from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, ) import pytest def setup_module(module): download_kernels() def test_actually_works(): """ Check if a spice function that depends on kernels works within the context manager. """ assert...
15422464.184185712
assert
numeric_literal
src/spiceypy/tests/test_context_manager.py
test_actually_works
125
null
AndrewAnnex/SpiceyPy
import os import time import timeit import itertools import pytest from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKernels, cleanup_cassini_kernels, cleanup_extra_kernels, cleanup_core_kernels, cwd, ) import numpy as np import numpy.testi...
res[0])
assert_*
complex_expr
src/spiceypy/benchmarks/test_cyice.py
test_evsgp4_v
512
null
AndrewAnnex/SpiceyPy
import os import time import timeit import itertools import pytest from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKernels, cleanup_cassini_kernels, cleanup_extra_kernels, cleanup_core_kernels, cwd, ) import numpy as np import numpy.testi...
100
assert
numeric_literal
src/spiceypy/benchmarks/test_cyice.py
test_et2lst_v
419
null
AndrewAnnex/SpiceyPy
import os import time import timeit import itertools import pytest from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKernels, cleanup_cassini_kernels, cleanup_extra_kernels, cleanup_core_kernels, cwd, ) import numpy as np import numpy.testi...
float
assert
variable
src/spiceypy/benchmarks/test_cyice.py
test_spkpvn_v
1,982
null
AndrewAnnex/SpiceyPy
import pytest import spiceypy as spice import pandas as pd import numpy as np import numpy.testing as npt import os import warnings from datetime import datetime, timezone import spiceypy.utils.callbacks from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKer...
0
assert
numeric_literal
src/spiceypy/tests/test_wrapper.py
test_bsrchd
405
null
AndrewAnnex/SpiceyPy
import os import time import timeit import itertools import pytest from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKernels, cleanup_cassini_kernels, cleanup_extra_kernels, cleanup_core_kernels, cwd, ) import numpy as np import numpy.testi...
res)
assert_*
variable
src/spiceypy/benchmarks/test_cyice.py
test_evsgp4
480
null
AndrewAnnex/SpiceyPy
import pytest import spiceypy as spice from spiceypy.cyice import cyice import spiceypy.found_catcher from spiceypy.tests.gettestkernels import cwd, CoreKernels, ExtraKernels import os def test_tkversion(): assert spice.exceptions._tkversion ==
spice.tkvrsn("toolkit")
assert
func_call
src/spiceypy/tests/test_spiceerrors.py
test_tkversion
34
null
AndrewAnnex/SpiceyPy
import pytest import spiceypy as spice from spiceypy.cyice import cyice import spiceypy.found_catcher from spiceypy.tests.gettestkernels import cwd, CoreKernels, ExtraKernels import os def test_no_loaded_files_exception(): with pytest.raises(spice.SpiceyError): spice.ckgp(0, 0, 0, "blah") spice.reset()...
spice.NotFoundError)
pytest.raises
complex_expr
src/spiceypy/tests/test_spiceerrors.py
test_no_loaded_files_exception
101
null
AndrewAnnex/SpiceyPy
import pytest import spiceypy as spice import pandas as pd import numpy as np import numpy.testing as npt import os import warnings from datetime import datetime, timezone import spiceypy.utils.callbacks from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKer...
2
assert
numeric_literal
src/spiceypy/tests/test_wrapper.py
test_bschoc
364
null
AndrewAnnex/SpiceyPy
import pytest import spiceypy as spice import pandas as pd import numpy as np import numpy.testing as npt import os import warnings from datetime import datetime, timezone import spiceypy.utils.callbacks from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKer...
1
assert
numeric_literal
src/spiceypy/tests/test_wrapper.py
test_brckti
353
null
AndrewAnnex/SpiceyPy
import pytest import spiceypy as spice import pandas as pd import numpy as np import numpy.testing as npt import os import warnings from datetime import datetime, timezone import spiceypy.utils.callbacks from spiceypy.tests.gettestkernels import ( download_kernels, CoreKernels, CassiniKernels, ExtraKer...
4
assert
numeric_literal
src/spiceypy/tests/test_wrapper.py
test_bschoc
365
null
AndrewAnnex/SpiceyPy
import pytest import spiceypy as spice from spiceypy.cyice import cyice import spiceypy.found_catcher from spiceypy.tests.gettestkernels import cwd, CoreKernels, ExtraKernels import os def test_found_error_checker(): with
( spice.exceptions.SpiceyError, spice.exceptions.SpiceyPyError, spice.exceptions.NotFoundError, ))
pytest.raises
collection
src/spiceypy/tests/test_spiceerrors.py
test_found_error_checker
135
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.lambda_at_edge import LambdaAtEdge def mock_lambda_at_edge_event(method, path, multi_value_query_parameters, body, body_base64_encoded): headers_raw = { "accept-encoding": "gzip,deflate", "x-forwarded-port": "443", ...
scope_body
assert
variable
tests/handlers/test_lambda_at_edge.py
test_aws_api_gateway_scope_real
241
null
Kludex/mangum
from __future__ import annotations import pytest from mangum import Mangum from mangum.handlers.alb import ALB def get_mock_aws_alb_event( method, path, query_parameters: dict[str, list[str]] | None, headers: dict[str, list[str]] | None, body, body_base64_encoded, multi_value_headers: boo...
expected_response
assert
variable
tests/handlers/test_alb.py
test_aws_alb_set_cookies
284
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.lambda_at_edge import LambdaAtEdge def mock_lambda_at_edge_event(method, path, multi_value_query_parameters, body, body_base64_encoded): headers_raw = { "accept-encoding": "gzip,deflate", "x-forwarded-port": "443", ...
{ "status": 200, "isBase64Encoded": False, "headers": {"content-type": [{"key": "content-type", "value": b"text/plain; charset=utf-8".decode()}]}, "body": "Hello world", }
assert
collection
tests/handlers/test_lambda_at_edge.py
test_aws_lambda_at_edge_exclude_
345
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.lambda_at_edge import LambdaAtEdge def mock_lambda_at_edge_event(method, path, multi_value_query_parameters, body, body_base64_encoded): headers_raw = { "accept-encoding": "gzip,deflate", "x-forwarded-port": "443", ...
handler.config["text_mime_types"]
assert
complex_expr
tests/handlers/test_lambda_at_edge.py
test_aws_lambda_at_edge_response_extra_mime_types
306
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.lambda_at_edge import LambdaAtEdge def mock_lambda_at_edge_event(method, path, multi_value_query_parameters, body, body_base64_encoded): headers_raw = { "accept-encoding": "gzip,deflate", "x-forwarded-port": "443", ...
{ "status": 200, "isBase64Encoded": False, "headers": {"content-type": [{"key": "content-type", "value": content_type.decode()}]}, "body": utf_res_body, }
assert
collection
tests/handlers/test_lambda_at_edge.py
test_aws_lambda_at_edge_response_extra_mime_types
318
null
Kludex/mangum
import logging import pytest from quart import Quart from starlette.applications import Starlette from starlette.responses import PlainTextResponse from typing_extensions import Literal from mangum import Mangum from mangum.exceptions import LifespanFailure from mangum.types import Receive, Scope, Send @pytest.mark....
{ "statusCode": 200, "isBase64Encoded": False, "headers": { "content-length": "13", "content-type": "text/plain; charset=utf-8", }, "multiValueHeaders": {}, "body": "Hello, world!", }
assert
collection
tests/test_lifespan.py
test_starlette_lifespan
293
null
Kludex/mangum
import pytest from mangum import Mangum from mangum.adapter import DEFAULT_TEXT_MIME_TYPES from mangum.exceptions import ConfigurationError from mangum.types import Receive, Scope, Send async def app(scope: Scope, receive: Receive, send: Send): ... def test_default_settings(): handler = Mangum(app) assert h...
"auto"
assert
string_literal
tests/test_adapter.py
test_default_settings
14
null
Kludex/mangum
from __future__ import annotations import base64 import gzip import json import logging from typing import cast import brotli import pytest from brotli_asgi import BrotliMiddleware from starlette.applications import Starlette from starlette.middleware.gzip import GZipMiddleware from starlette.requests import Request ...
base64.b64encode(brotli.compress(body.encode())).decode()
assert
func_call
tests/test_http.py
test_http_binary_br_response
586
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import HTTPGateway def get_mock_aws_http_gateway_event_v1(method, path, query_parameters, body, body_base64_encoded): query_string = urllib.parse.urlencode(query_parameters if query_parameters else {}) return { ...
{ "statusCode": 200, "isBase64Encoded": res_base64_encoded, "headers": {"content-type": content_type.decode()}, "body": res_body, }
assert
collection
tests/handlers/test_http_gateway.py
test_aws_http_gateway_response_v2
562
null
Kludex/mangum
from __future__ import annotations import pytest from mangum import Mangum from mangum.handlers.alb import ALB def get_mock_aws_alb_event( method, path, query_parameters: dict[str, list[str]] | None, headers: dict[str, list[str]] | None, body, body_base64_encoded, multi_value_headers: boo...
{ "statusCode": 200, "isBase64Encoded": True, "headers": {"content-type": content_type.decode()}, "body": b64_res_body, }
assert
collection
tests/handlers/test_alb.py
test_aws_alb_response_extra_mime_types
348
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import HTTPGateway def get_mock_aws_http_gateway_event_v1(method, path, query_parameters, body, body_base64_encoded): query_string = urllib.parse.urlencode(query_parameters if query_parameters else {}) return { ...
{ "statusCode": 200, "isBase64Encoded": False, "headers": {"content-type": content_type.decode()}, "multiValueHeaders": {}, "body": utf_res_body, }
assert
collection
tests/handlers/test_http_gateway.py
test_aws_http_gateway_response_v1_extra_mime_types
608
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import APIGateway def get_mock_aws_api_gateway_event(method, path, multi_value_query_parameters, body, body_base64_encoded): return { "path": path, "body": body, "isBase64Encoded": body_base64_enc...
{ "statusCode": 200, "isBase64Encoded": False, "headers": {"content-type": content_type.decode()}, "multiValueHeaders": {}, "body": utf_res_body, }
assert
collection
tests/handlers/test_api_gateway.py
test_aws_api_gateway_response_extra_mime_types
381
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import APIGateway def get_mock_aws_api_gateway_event(method, path, multi_value_query_parameters, body, body_base64_encoded): return { "path": path, "body": body, "isBase64Encoded": body_base64_enc...
handler.config["text_mime_types"]
assert
complex_expr
tests/handlers/test_api_gateway.py
test_aws_api_gateway_response_extra_mime_types
368
null
Kludex/mangum
from __future__ import annotations import base64 import gzip import json import logging from typing import cast import brotli import pytest from brotli_asgi import BrotliMiddleware from starlette.applications import Starlette from starlette.middleware.gzip import GZipMiddleware from starlette.requests import Request ...
{ "content-encoding": "br", "content-type": "application/json", "content-length": "19", "vary": "Accept-Encoding", }
assert
collection
tests/test_http.py
test_http_binary_br_response
580
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import APIGateway def get_mock_aws_api_gateway_event(method, path, multi_value_query_parameters, body, body_base64_encoded): return { "path": path, "body": body, "isBase64Encoded": body_base64_enc...
{ "statusCode": 200, "isBase64Encoded": res_base64_encoded, "headers": {"content-type": content_type.decode()}, "multiValueHeaders": {}, "body": res_body, }
assert
collection
tests/handlers/test_api_gateway.py
test_aws_api_gateway_response
338
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import APIGateway def get_mock_aws_api_gateway_event(method, path, multi_value_query_parameters, body, body_base64_encoded): return { "path": path, "body": body, "isBase64Encoded": body_base64_enc...
scope_body
assert
variable
tests/handlers/test_api_gateway.py
test_aws_api_gateway_scope_real
238
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import APIGateway def get_mock_aws_api_gateway_event(method, path, multi_value_query_parameters, body, body_base64_encoded): return { "path": path, "body": body, "isBase64Encoded": body_base64_enc...
{ "statusCode": 200, "isBase64Encoded": False, "headers": {"content-type": b"text/plain; charset=utf-8".decode()}, "multiValueHeaders": {}, "body": "Hello world", }
assert
collection
tests/handlers/test_api_gateway.py
test_aws_api_gateway_exclude_headers
409
null
Kludex/mangum
import pytest from mangum import Mangum from mangum.adapter import DEFAULT_TEXT_MIME_TYPES from mangum.exceptions import ConfigurationError from mangum.types import Receive, Scope, Send async def app(scope: Scope, receive: Receive, send: Send): ... @pytest.mark.parametrize( "arguments,message", [ ( ...
ConfigurationError)
pytest.raises
variable
tests/test_adapter.py
test_invalid_options
30
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import APIGateway def get_mock_aws_api_gateway_event(method, path, multi_value_query_parameters, body, body_base64_encoded): return { "path": path, "body": body, "isBase64Encoded": body_base64_enc...
{ "statusCode": 200, "isBase64Encoded": True, "headers": {"content-type": content_type.decode()}, "multiValueHeaders": {}, "body": b64_res_body, }
assert
collection
tests/handlers/test_api_gateway.py
test_aws_api_gateway_response_extra_mime_types
369
null
Kludex/mangum
from __future__ import annotations import base64 import gzip import json import logging from typing import cast import brotli import pytest from brotli_asgi import BrotliMiddleware from starlette.applications import Starlette from starlette.middleware.gzip import GZipMiddleware from starlette.requests import Request ...
body.encode()
assert
func_call
tests/test_http.py
test_http_binary_gzip_response
248
null
Kludex/mangum
from __future__ import annotations import pytest from mangum import Mangum from mangum.handlers.alb import ALB def get_mock_aws_alb_event( method, path, query_parameters: dict[str, list[str]] | None, headers: dict[str, list[str]] | None, body, body_base64_encoded, multi_value_headers: boo...
handler.config["text_mime_types"]
assert
complex_expr
tests/handlers/test_alb.py
test_aws_alb_response_extra_mime_types
347
null