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 |
|---|---|---|---|---|---|---|---|---|---|
pyccel/pyccel | import pytest
import numpy as np
from pyccel import epyccel
RTOL = 2e-14
ATOL = 1e-15
def Module_5(language):
import modules.Module_5 as mod
modnew = epyccel(mod, language = language)
return mod, modnew
def test_f4(language):
def f4(x : 'bool' = None):
if x is None :
return Tr... | f4(None) | assert | func_call | tests/epyccel/test_epyccel_optional_args.py | test_f4 | 83 | null | |
pyccel/pyccel | import pytest
import numpy as np
from modules import loops
from pyccel import epyccel
def test_factorial(language):
f1 = loops.factorial
f2 = epyccel( f1, language = language )
assert f1( 11 ) == | f2( 11 ) | assert | func_call | tests/epyccel/test_loops.py | test_factorial | 19 | null | |
pyccel/pyccel | import pytest
import numpy as np
import modules.generic_functions as mod
import modules.generic_functions_2 as mod2
from pyccel import epyccel
def modnew(language):
return epyccel(mod, language = language)
def test_dup_header(language):
f1 = epyccel(mod2.dup_header , language = language)
f2 = mod2.dup_hea... | f2(0.0) | assert | func_call | tests/epyccel/test_generic_functions.py | test_dup_header | 416 | null | |
pyccel/pyccel | from typing import Final, TypeVar
import pytest
import numpy as np
from pyccel import epyccel
def limited_language(request):
return request.param
def test_append_user_defined_objects(limited_language):
import modules.list_user_defined_objs1 as mod
modnew = epyccel(mod, language=limited_language)
pyth... | ai.x | assert | complex_expr | tests/epyccel/test_epyccel_lists.py | test_append_user_defined_objects | 287 | null | |
pyccel/pyccel | import pytest
import numpy as np
from pyccel import epyccel
RTOL = 2e-14
ATOL = 1e-15
def Module_5(language):
import modules.Module_5 as mod
modnew = epyccel(mod, language = language)
return mod, modnew
def test_f4(language):
def f4(x : 'bool' = None):
if x is None :
return Tr... | f4() | assert | func_call | tests/epyccel/test_epyccel_optional_args.py | test_f4 | 82 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
def test_f6(language):
def f6(x : 'int'):
# a = x if x < 0 else (1 if x < 5 else (complex(0, 1) if x == 5 else 6.5))
a = x if x < 0 else 1 if x < 5 else complex(0, 1) if x == 5 else 6.5
return a
def f6wp(x : 'int'):
a = x if x < 0 else ... | f6(4) | assert | func_call | tests/epyccel/test_epyccel_IfTernaryOperator.py | test_f6 | 111 | null | |
pyccel/pyccel | import pytest
import numpy as np
from pyccel import epyccel
RTOL = 2e-14
ATOL = 1e-15
def Module_5(language):
import modules.Module_5 as mod
modnew = epyccel(mod, language = language)
return mod, modnew
def test_f1(language):
def f1(x : 'int' = None):
if x is None :
return 5
... | f1(2) | assert | func_call | tests/epyccel/test_epyccel_optional_args.py | test_f1 | 28 | null | |
pyccel/pyccel | import sys
from typing import TypeVar, Final
import numpy as np
import pytest
from pyccel import epyccel
from pyccel.errors.errors import PyccelError
def test_type_var_context(language):
T = TypeVar('T', int, float)
def f(a : T, b : T) -> T:
return 2*a + b
epyc_f = epyccel(f, language=language)
... | f(1, 1) | assert | func_call | tests/epyccel/test_epyccel_context_clues.py | test_type_var_context | 89 | null | |
pyccel/pyccel | from math import nan, inf, modf
import os
import sys
from typing import TypeVar
import pytest
from numpy.random import rand, randint, uniform
from numpy import isclose
from pyccel import epyccel
RTOL = 1e-13
ATOL = 1e-14
max_float = 3.40282e5 # maximum positive float
min_float = sys.float_info.min # Minimum ... | f1(inf) | assert | func_call | tests/epyccel/recognised_functions/test_math_funcs.py | test_isfinite_call | 567 | null | |
pyccel/pyccel | import sys
from typing import TypeVar
import pytest
from numpy.random import uniform
import numpy as np
from test_numpy_funcs import (min_int, max_int, min_int8, max_int8,
min_int16, max_int16, min_int32, max_int32, max_int64, min_int64)
from test_numpy_funcs import max_float, min_float... | pycc | assert | variable | tests/epyccel/recognised_functions/test_numpy_types.py | test_literal_complex64 | 974 | null | |
pyccel/pyccel | import pytest
import numpy as np
import modules.expose_classes as mod
from pyccel import epyccel
RTOL = 2e-14
ATOL = 1e-15
def modnew(language):
return epyccel(mod, language = language)
@pytest.mark.parametrize( 'language', (
pytest.param("fortran", marks = pytest.mark.fortran),
pytest.param("c",... | p_l.y | assert | complex_expr | tests/epyccel/test_epyccel_classes.py | test_classes | 306 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
def test_f1(language):
def f1(x : 'int'):
a = 5 if x < 5 else x
return a
f = epyccel(f1, language = language)
# ...
assert f(6) == f1(6)
assert f(4) == | f1(4) | assert | func_call | tests/epyccel/test_epyccel_IfTernaryOperator.py | test_f1 | 17 | null | |
pyccel/pyccel | from typing import TypeVar
import pytest
import numpy as np
from numpy.random import randint
from pyccel import epyccel
@pytest.mark.parametrize( 'language', (
pytest.param("fortran", marks = pytest.mark.fortran),
pytest.param("c", marks = [
pytest.mark.xfail(reason="Max not implemented in... | f_epyc() | assert | func_call | tests/epyccel/test_epyccel_generators.py | test_max | 95 | null | |
pyccel/pyccel | import pytest
import numpy as np
import modules.expose_classes as mod
from pyccel import epyccel
RTOL = 2e-14
ATOL = 1e-15
def modnew(language):
return epyccel(mod, language = language)
def test_class_return(modnew):
a = modnew.get_A()
assert isinstance(a, modnew.A)
a_new, i = modnew.get_A_int()
... | i2 | assert | variable | tests/epyccel/test_epyccel_classes.py | test_class_return | 39 | null | |
pyccel/pyccel | import pytest
import numpy as np
from pyccel import epyccel
RTOL = 2e-14
ATOL = 1e-15
def Module_5(language):
import modules.Module_5 as mod
modnew = epyccel(mod, language = language)
return mod, modnew
def test_f4(language):
def f4(x : 'bool' = None):
if x is None :
return Tr... | f4(True) | assert | func_call | tests/epyccel/test_epyccel_optional_args.py | test_f4 | 81 | null | |
pyccel/pyccel | import pytest
import numpy as np
from pyccel import epyccel
RTOL = 2e-14
ATOL = 1e-15
def Module_5(language):
import modules.Module_5 as mod
modnew = epyccel(mod, language = language)
return mod, modnew
def test_f14(language):
def f14(x : 'int' = None, y : 'int' = None):
if x is None :
... | f14(2,7) | assert | func_call | tests/epyccel/test_epyccel_optional_args.py | test_f14 | 206 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
from pyccel.decorators import stack_array
from pyccel.errors.errors import Errors, PyccelSemanticError
from pyccel.errors.messages import (ARRAY_REALLOCATION,
ARRAY_DEFINITION_IN_LOOP,
INCOMPATIBLE_REDEFINI... | g() | assert | func_call | tests/epyccel/test_arrays_multiple_assignments.py | test_no_reallocation | 33 | null | |
pyccel/pyccel | import platform
import pytest
from pyccel import epyccel
def test_output_types_2(language):
def cast_to_float(a : 'int'):
b = float(a)
return b
f = epyccel(cast_to_float,language= language)
assert(type(cast_to_float(5)) == | type(f(5)) | assert | func_call | tests/epyccel/test_kind.py | test_output_types_2 | 61 | null | |
pyccel/pyccel | import pytest
import numpy as np
import modules.expose_classes as mod
from pyccel import epyccel
RTOL = 2e-14
ATOL = 1e-15
def modnew(language):
return epyccel(mod, language = language)
def test_classes_3(language):
import classes.classes_3 as mod
modnew = epyccel(mod, language = language)
p2_py = m... | p_l.X | assert | complex_expr | tests/epyccel/test_epyccel_classes.py | test_classes_3 | 150 | null | |
pyccel/pyccel | import inspect
import pytest
import numpy as np
from modules import pointers as pointers_module
from modules import return_pointers
from pyccel import epyccel
pointers_funcs = [(f, getattr(pointers_module,f)) for f in pointers_module.__all__ if inspect.isfunction(getattr(pointers_module,f))]
def compare_python_pycce... | y | assert | variable | tests/epyccel/test_pointers.py | test_return_pointers | 60 | null | |
pyccel/pyccel | import inspect
from typing import TypeVar
import pytest
import numpy as np
from modules import tuples as tuples_module
from pyccel import epyccel
from pyccel.errors.errors import PyccelError
def is_func_with_0_args(f):
""" Test if name 'f' corresponds to an argument in the
tuples module with no arguments
... | int_epyc | assert | variable | tests/epyccel/test_tuples.py | test_homogeneous_tuples_template_args | 160 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
@pytest.mark.parametrize( 'language', (
pytest.param("fortran", marks = [
pytest.mark.skip(reason="Copy of a list not yet supported (required to handle the generated temporary)."),
pytest.mark.fortran]
),
pytest.param("c", marks ... | f7(6) | assert | func_call | tests/epyccel/test_epyccel_IfTernaryOperator.py | test_f7 | 145 | null | |
pyccel/pyccel | import sys
import pytest
import numpy as np
from numpy.random import rand, randint
import modules.complex_func as mod
from pyccel import epyccel
ATOL = 1e-15
RTOL = 2e-14
deprecation = (sys.version_info >= (3, 14))
deprecation_reason = 'Since Python 3.14 complex() requires real arguments'
@pytest.mark.parametrize(... | f() | assert | func_call | tests/epyccel/test_epyccel_complex_func.py | test_create_complex_literal | 32 | null | |
pyccel/pyccel | import inspect
import pytest
import numpy as np
from modules import pointers as pointers_module
from modules import return_pointers
from pyccel import epyccel
pointers_funcs = [(f, getattr(pointers_module,f)) for f in pointers_module.__all__ if inspect.isfunction(getattr(pointers_module,f))]
def compare_python_pycce... | None | assert | none_literal | tests/epyccel/test_pointers.py | compare_python_pyccel | 14 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
from pyccel.decorators import stack_array
from pyccel.errors.errors import Errors, PyccelSemanticError
from pyccel.errors.messages import (ARRAY_REALLOCATION,
ARRAY_DEFINITION_IN_LOOP,
INCOMPATIBLE_REDEFINI... | 'x' | assert | string_literal | tests/epyccel/test_arrays_multiple_assignments.py | test_creation_in_loop_stack | 147 | null | |
pyccel/pyccel | from math import nan, inf, modf
import os
import sys
from typing import TypeVar
import pytest
from numpy.random import rand, randint, uniform
from numpy import isclose
from pyccel import epyccel
RTOL = 1e-13
ATOL = 1e-14
max_float = 3.40282e5 # maximum positive float
min_float = sys.float_info.min # Minimum ... | f1(nan) | assert | func_call | tests/epyccel/recognised_functions/test_math_funcs.py | test_isfinite_call | 565 | null | |
pyccel/pyccel | import pytest
import numpy as np
import modules.expose_classes as mod
from pyccel import epyccel
RTOL = 2e-14
ATOL = 1e-15
def modnew(language):
return epyccel(mod, language = language)
def test_class_function(modnew):
c = modnew.C()
assert c.get_3() == | 3 | assert | numeric_literal | tests/epyccel/test_epyccel_classes.py | test_class_function | 58 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
def test_f5(language):
def f5(x : 'int'):
a = x if x < 5 else 5 if x == 5 else 5.5
return a
def f5wp(x : 'int'):
a = x if x < 5 else (5 if x == 5 else 5.5)
return a
f = epyccel(f5, language = language)
fwp = epyccel(f5wp, langu... | f5(4) | assert | func_call | tests/epyccel/test_epyccel_IfTernaryOperator.py | test_f5 | 88 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
from pyccel.decorators import stack_array
from pyccel.errors.errors import Errors, PyccelSemanticError
from pyccel.errors.messages import (ARRAY_REALLOCATION,
ARRAY_DEFINITION_IN_LOOP,
INCOMPATIBLE_REDEFINI... | f2(True) | assert | func_call | tests/epyccel/test_arrays_multiple_assignments.py | test_Assign_after_If | 370 | null | |
pyccel/pyccel | import numpy as np
import pytest
from pyccel import epyccel
@pytest.mark.parametrize( 'language', (
pytest.param("fortran", marks = [pytest.mark.fortran]),
pytest.param("c", marks = [pytest.mark.c]),
pytest.param("python", marks = [
pytest.mark.skip(reason=("isinstance is evaluated ... | f(3) | assert | func_call | tests/epyccel/test_epyccel_compile_time_if.py | test_type_differentiation | 72 | null | |
pyccel/pyccel | from mpi4py import MPI
import pytest
import numpy as np
from pyccel import epyccel
RTOL = 2e-14
ATOL = 1e-15
@pytest.mark.mpi
def test_function(language):
from modules.Module_1 import f, g, h
comm = MPI.COMM_WORLD
f_fast = epyccel(f, comm=comm, language=language)
g_fast = epyccel(g, comm=comm, lang... | f | assert | variable | tests/epyccel/test_parallel_epyccel.py | test_function | 61 | null | |
pyccel/pyccel | import os
from pathlib import Path
import shutil
import subprocess
import sys
import pytest
from test_pyccel import compare_pyth_fort_output
from pyccel.utilities.introspect import get_compiler_info
def language(request):
return request.param
def compile_low_level(stem, input_folder, output_folder, cwd, languag... | py_out | assert | variable | tests/pyccel/test_pyccel_wrap.py | test_class_final_fortran_keyword | 137 | null | |
pyccel/pyccel | import pytest
import numpy as np
import modules.expose_classes as mod
from pyccel import epyccel
RTOL = 2e-14
ATOL = 1e-15
def modnew(language):
return epyccel(mod, language = language)
def test_classes_3(language):
import classes.classes_3 as mod
modnew = epyccel(mod, language = language)
p2_py = m... | p_l.x | assert | complex_expr | tests/epyccel/test_epyccel_classes.py | test_classes_3 | 149 | null | |
pyccel/pyccel | import os
import pytest
import numpy as np
from numpy import iinfo, finfo
from numpy.random import randint, uniform
from pyccel import epyccel
from modules import arrays
RTOL = 1e-12
ATOL = 1e-16
def check_array_equal(a, b):
"""
Check that two arrays are equal.
Check that two arrays are equal. To... | f2() | assert | func_call | tests/epyccel/test_arrays.py | test_array_int_1d_initialization_1 | 320 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
def test_f8(language):
def f8(x : 'int'):
a = (1+0j, 2+0j) if x < 5 else (complex(5, 1), complex(2, 2))
return a[0]
def f8wp(x : 'int'):
a = (1+0j, 2+0j) if x < 5 else ((complex(5, 1), complex(2, 2)) if x > 5 else (complex(7, 2), complex(3, 3))... | f8(6) | assert | func_call | tests/epyccel/test_epyccel_IfTernaryOperator.py | test_f8 | 166 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
def test_f4(language):
def f4(x : 'int'):
a = x if x < 5 else 5 >> 2
return a
def f4wp(x : 'int'):
a = (x if x < 5 else 5) >> 2
return a
f = epyccel(f4, language = language)
fwp = epyccel(f4wp, language = language)
# ...
... | f4(4) | assert | func_call | tests/epyccel/test_epyccel_IfTernaryOperator.py | test_f4 | 68 | null | |
pyccel/pyccel | from typing import Final, TypeVar
import pytest
import numpy as np
from pyccel import epyccel
def limited_language(request):
return request.param
def test_list_arg(stc_language):
def list_arg(arg : 'list[int]', n : int):
arg.extend(range(n))
epyccel_func = epyccel(list_arg, language = stc_languag... | arg_pyt | assert | variable | tests/epyccel/test_epyccel_lists.py | test_list_arg | 902 | null | |
pyccel/pyccel | import pytest
import numpy as np
import modules.expose_classes as mod
from pyccel import epyccel
RTOL = 2e-14
ATOL = 1e-15
def modnew(language):
return epyccel(mod, language = language)
def test_classes_8(language):
import classes.classes_8 as mod
modnew = epyccel(mod, language = language)
a_py = mo... | a_l.x | assert | complex_expr | tests/epyccel/test_epyccel_classes.py | test_classes_8 | 243 | null | |
pyccel/pyccel | import sys
from typing import TypeVar, Final
import numpy as np
import pytest
from pyccel import epyccel
from pyccel.errors.errors import PyccelError
def test_container_type_alias_context_2(language):
T = Final[list[int]]
def f(a : T):
return a[0]
a = [3,2,1]
epyc_f = epyccel(f, language=lang... | epyc_f(a) | assert | func_call | tests/epyccel/test_epyccel_context_clues.py | test_container_type_alias_context_2 | 145 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
from pyccel.decorators import stack_array
from pyccel.errors.errors import Errors, PyccelSemanticError
from pyccel.errors.messages import (ARRAY_REALLOCATION,
ARRAY_DEFINITION_IN_LOOP,
INCOMPATIBLE_REDEFINI... | g(c) | assert | func_call | tests/epyccel/test_arrays_multiple_assignments.py | test_creation_in_if_heap | 167 | null | |
pyccel/pyccel | from mpi4py import MPI
import pytest
import numpy as np
from pyccel import epyccel
RTOL = 2e-14
ATOL = 1e-15
@pytest.mark.mpi
def test_function(language):
from modules.Module_1 import f, g, h
comm = MPI.COMM_WORLD
f_fast = epyccel(f, comm=comm, language=language)
g_fast = epyccel(g, comm=comm, lang... | g | assert | variable | tests/epyccel/test_parallel_epyccel.py | test_function | 62 | null | |
pyccel/pyccel | import logging
import os
import shutil
import pytest
from mpi4py import MPI
from pyccel.commands.pyccel_clean import pyccel_clean
github_debugging = 'DEBUG' in os.environ
language_markers = ('language_agnostic', 'fortran', 'c', 'python')
@pytest.fixture(autouse=True)
def check_language_markers(request):
"""
... | 0 | assert | numeric_literal | tests/conftest.py | check_language_markers | 22 | null | |
pyccel/pyccel | from typing import TypeVar
import pytest
import numpy as np
from pyccel import epyccel
def test_f3(language):
def f3(x : 'float' = 1.5, y : 'float' = 2.5):
return x+y
f = epyccel(f3, language=language)
# ...
assert f(19.2,6.7) == f3(19.2,6.7)
assert f(4.5) == f3(4.5)
assert f(y =... | f3() | assert | func_call | tests/epyccel/test_epyccel_default_args.py | test_f3 | 60 | null | |
pyccel/pyccel | import subprocess
import json
import os
import platform
import shutil
import sys
import re
import random
import pytest
import numpy as np
from filelock import FileLock
from pyccel.codegen.pipeline import execute_pyccel
from pyccel.ast.utilities import python_builtin_libs
from pyccel.compilers.default_compilers import a... | l | assert | variable | tests/pyccel/test_pyccel.py | test_time_execution_flag | 1,267 | null | |
pyccel/pyccel | from numpy.random import randint, rand
import numpy as np
from numpy import iinfo
from pyccel import epyccel
min_int = iinfo(np.int32).min
max_int = iinfo(np.int32).max
def test_swap_basic_3(language):
def swp(a : int, b : int, c : int):
a, b, c = b, c, a
return a, b, c
f = epyccel(swp, langu... | swp(2,4,8) | assert | func_call | tests/epyccel/test_epyccel_expressions.py | test_swap_basic_3 | 43 | null | |
pyccel/pyccel | import pytest
from numpy import ones
from pyccel import epyccel
from pyccel.decorators import inline
def test_import_from(language):
def f2(x : 'int[:]'):
from numpy import shape
s = shape(x)[0]
return s
f = epyccel(f2, language = language)
x = ones(10, dtype=int)
assert f(x... | f2(x) | assert | func_call | tests/epyccel/test_imports.py | test_import_from | 30 | null | |
pyccel/pyccel | import inspect
import pytest
import numpy as np
from modules import pointers as pointers_module
from modules import return_pointers
from pyccel import epyccel
pointers_funcs = [(f, getattr(pointers_module,f)) for f in pointers_module.__all__ if inspect.isfunction(getattr(pointers_module,f))]
def compare_python_pycce... | x | assert | variable | tests/epyccel/test_pointers.py | test_return_pointers | 58 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
def test_f5(language):
def f5(x : 'int'):
a = x if x < 5 else 5 if x == 5 else 5.5
return a
def f5wp(x : 'int'):
a = x if x < 5 else (5 if x == 5 else 5.5)
return a
f = epyccel(f5, language = language)
fwp = epyccel(f5wp, langu... | f5(6) | assert | func_call | tests/epyccel/test_epyccel_IfTernaryOperator.py | test_f5 | 87 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
def test_f3(language):
def f3(x : 'int'):
a = x if x < 5 else 5 + 2
return a
def f3wp(x : 'int'):
a = (x if x < 5 else 5) + 2
return a
f = epyccel(f3, language = language)
fwp = epyccel(f3wp, language = language)
# ...
... | f3(6) | assert | func_call | tests/epyccel/test_epyccel_IfTernaryOperator.py | test_f3 | 46 | null | |
pyccel/pyccel | import sys
import pytest
import numpy as np
from numpy.random import rand, randint
import modules.complex_func as mod
from pyccel import epyccel
ATOL = 1e-15
RTOL = 2e-14
deprecation = (sys.version_info >= (3, 14))
deprecation_reason = 'Since Python 3.14 complex() requires real arguments'
def test_create_complex_v... | f(a,b) | assert | func_call | tests/epyccel/test_epyccel_complex_func.py | test_create_complex_var__int_int | 52 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
from pyccel.decorators import stack_array
from pyccel.errors.errors import Errors, PyccelSemanticError
from pyccel.errors.messages import (ARRAY_REALLOCATION,
ARRAY_DEFINITION_IN_LOOP,
INCOMPATIBLE_REDEFINI... | 2 | assert | numeric_literal | tests/epyccel/test_arrays_multiple_assignments.py | test_creation_in_loop_stack | 138 | null | |
pyccel/pyccel | import os
import sys
from typing import TypeVar
import pytest
from numpy.random import rand, randn, uniform
from numpy import isclose, iinfo, finfo, complex64, complex128
import numpy as np
from pyccel import epyccel
min_int8 = iinfo('int8').min
max_int8 = iinfo('int8').max
min_int16 = iinfo('int16').min
max_int16 =... | out.dtype | assert | complex_expr | tests/epyccel/recognised_functions/test_numpy_funcs.py | test_numpy_linspace_array_like_2d | 6,041 | null | |
pyccel/pyccel | import logging
import os
import shutil
import pytest
from mpi4py import MPI
from pyccel.commands.pyccel_clean import pyccel_clean
github_debugging = 'DEBUG' in os.environ
language_markers = ('language_agnostic', 'fortran', 'c', 'python')
def check_language_markers(request):
"""
Ensure all tests have a langua... | 1 | assert | numeric_literal | tests/conftest.py | skipif_by_language | 55 | null | |
pyccel/pyccel | import inspect
import pytest
import numpy as np
from modules import pointers as pointers_module
from modules import return_pointers
from pyccel import epyccel
pointers_funcs = [(f, getattr(pointers_module,f)) for f in pointers_module.__all__ if inspect.isfunction(getattr(pointers_module,f))]
def compare_python_pycce... | pycc | assert | variable | tests/epyccel/test_pointers.py | compare_python_pyccel | 30 | null | |
pyccel/pyccel | from typing import Final, TypeVar
import pytest
import numpy as np
from pyccel import epyccel
def limited_language(request):
return request.param
def test_append_basic(language):
def f():
a = [1, 2, 3]
a.append(4)
return len(a), a[0], a[1], a[2], a[3]
epyc_f = epyccel(f, language=... | epyc_f() | assert | func_call | tests/epyccel/test_epyccel_lists.py | test_append_basic | 184 | null | |
pyccel/pyccel | import os
import sys
from typing import TypeVar
import pytest
from numpy.random import rand, randn, uniform
from numpy import isclose, iinfo, finfo, complex64, complex128
import numpy as np
from pyccel import epyccel
min_int8 = iinfo('int8').min
max_int8 = iinfo('int8').max
min_int16 = iinfo('int16').min
max_int16 =... | res_pyt | assert | variable | tests/epyccel/recognised_functions/test_numpy_funcs.py | test_where_combined_types | 5,747 | null | |
pyccel/pyccel | import numpy as np
import pytest
from pyccel import epyccel
@pytest.mark.parametrize( 'language', (
pytest.param("fortran", marks = [pytest.mark.fortran]),
pytest.param("c", marks = [pytest.mark.c]),
pytest.param("python", marks = [
pytest.mark.skip(reason=("isinstance is evaluated ... | f(y) | assert | func_call | tests/epyccel/test_epyccel_compile_time_if.py | test_rank_differentiation_1 | 28 | null | |
pyccel/pyccel | import pytest
import numpy as np
import modules.generic_functions as mod
import modules.generic_functions_2 as mod2
from pyccel import epyccel
def modnew(language):
return epyccel(mod, language = language)
def test_default_var_1(language):
f1 = epyccel(mod2.default_var_1, language = language)
f2 = mod2.de... | f2(5.3) | assert | func_call | tests/epyccel/test_generic_functions.py | test_default_var_1 | 108 | null | |
pyccel/pyccel | import pytest
import numpy as np
import modules.generic_functions as mod
import modules.generic_functions_2 as mod2
from pyccel import epyccel
def modnew(language):
return epyccel(mod, language = language)
def test_default_var_1(language):
f1 = epyccel(mod2.default_var_1, language = language)
f2 = mod2.de... | f2(5) | assert | func_call | tests/epyccel/test_generic_functions.py | test_default_var_1 | 109 | null | |
pyccel/pyccel | from typing import TypeVar, Final
import pytest
from pyccel import epyccel
def python_only_language(request):
return request.param
def test_set_arg(stc_language):
def set_arg(arg : 'set[int]', n : int):
arg.update(range(n))
epyccel_func = epyccel(set_arg, language = stc_language)
arg_pyc = {7... | arg_pyt | assert | variable | tests/epyccel/test_epyccel_sets.py | test_set_arg | 746 | null | |
pyccel/pyccel | from numpy.random import randint, rand
import numpy as np
from numpy import iinfo
from pyccel import epyccel
min_int = iinfo(np.int32).min
max_int = iinfo(np.int32).max
def test_swap_basic(language):
def swp(a : int, b : int):
(a, b) = (b, a)
return a, b
f = epyccel(swp, language=language)
... | swp(2,4) | assert | func_call | tests/epyccel/test_epyccel_expressions.py | test_swap_basic | 17 | null | |
pyccel/pyccel | import os
import pytest
from pyccel.parser.parser import Parser
from pyccel.errors.errors import Errors
from pyccel.ast.basic import PyccelAstNode
from pyccel.ast.core import Assign, Return, FunctionDef, AugAssign, FunctionDefArgument
from pyccel.ast.datatypes import PythonNativeInt
from pyccel.as... | 3 | assert | numeric_literal | tests/ast/test_basic.py | test_get_user_nodes | 88 | null | |
pyccel/pyccel | import sys
from typing import TypeVar, Final
import numpy as np
import pytest
from pyccel import epyccel
from pyccel.errors.errors import PyccelError
def test_container_type_alias_context_1(language):
T = list[int]
def f(a : Final[T]):
return a[0]
b = [4,5,6]
epyc_f = epyccel(f, language=lang... | epyc_f(b) | assert | func_call | tests/epyccel/test_epyccel_context_clues.py | test_container_type_alias_context_1 | 134 | null | |
pyccel/pyccel | import pytest
import modules.function_call_before_definition as mod1
import modules.function_call_before_definition_2 as mod2
from pyccel import epyccel
def test_fun_2(language):
modnew = epyccel(mod2, language = language)
assert mod2.a == | modnew.a | assert | complex_expr | tests/epyccel/test_function_call_before_definition.py | test_fun_2 | 16 | null | |
pyccel/pyccel | import os
from pathlib import Path
import shutil
import subprocess
import sys
import pytest
from test_pyccel import compare_pyth_fort_output
from pyccel.utilities.introspect import get_compiler_info
def language(request):
return request.param
def compile_low_level(stem, input_folder, output_folder, cwd, languag... | p.stdout | assert | complex_expr | tests/pyccel/test_pyccel_wrap.py | test_convert_only | 174 | null | |
pyccel/pyccel | import pytest
import numpy as np
from modules import loops
from pyccel import epyccel
def test_breaks(language):
f1 = loops.fizzbuzz_search_with_breaks
f2 = epyccel( f1, language = language )
fizz = 2
buzz = 3
max_val = 12
out1 = f1(fizz, buzz, max_val)
out2 = f2(fizz, buzz, max_val)
... | out2 | assert | variable | tests/epyccel/test_loops.py | test_breaks | 201 | null | |
pyccel/pyccel | from cmath import nanj, infj, pi
import os
import sys
from typing import TypeVar
import pytest
from numpy.random import rand, uniform
from numpy import isclose
from pyccel import epyccel
RTOL = sys.float_info.epsilon*1000
ATOL = sys.float_info.epsilon*100
max_float = 3.40282e5 # maximum positive float
min_fl... | f1(-infj) | assert | func_call | tests/epyccel/recognised_functions/test_cmath_funcs.py | test_isfinite_call | 302 | null | |
pyccel/pyccel | import pytest
from pyccel import epyccel
def test_f9(language):
def f9(x : 'int'):
a = 1 + 2 if x < 5 else 3
return a
def f9wp1(x : 'int'):
a = 1 + (2 if x < 5 else 3)
return a
def f9wp2(x : 'int'):
a = (1 + 2) if x < 5 else 3
return a
f = epyccel(f9,... | f9(6) | assert | func_call | tests/epyccel/test_epyccel_IfTernaryOperator.py | test_f9 | 191 | null | |
pyccel/pyccel | import os
import pytest
import numpy as np
from numpy import iinfo, finfo
from numpy.random import randint, uniform
from pyccel import epyccel
from modules import arrays
RTOL = 1e-12
ATOL = 1e-16
def check_array_equal(a, b):
"""
Check that two arrays are equal.
Check that two arrays are equal. To... | f2(n) | assert | func_call | tests/epyccel/test_arrays.py | test_constant_negative_index | 2,131 | null | |
pyccel/pyccel | import sys
from typing import TypeVar, Final
import numpy as np
import pytest
from pyccel import epyccel
from pyccel.errors.errors import PyccelError
@pytest.mark.skipif(sys.version_info < (3, 10), reason="Union of types implemented in Python 3.10")
def test_type_union_context(language):
T = int | float #pylint: d... | epyc_f(3.5) | assert | func_call | tests/epyccel/test_epyccel_context_clues.py | test_type_union_context | 47 | null | |
pyccel/pyccel | import numpy as np
import pytest
from pyccel import epyccel
@pytest.mark.parametrize( 'language', (
pytest.param("fortran", marks = [pytest.mark.fortran]),
pytest.param("c", marks = [pytest.mark.c]),
pytest.param("python", marks = [
pytest.mark.skip(reason=("isinstance is evaluated ... | f(4.0) | assert | func_call | tests/epyccel/test_epyccel_compile_time_if.py | test_type_differentiation | 74 | null | |
GitGuardian/ggshield | from click.testing import CliRunner
from ggshield.__main__ import cli
from ggshield.core.errors import ExitCode
from tests.unit.conftest import assert_invoke_exited_with, assert_invoke_ok, my_vcr
AWS_TYPE = "AWS"
@my_vcr.use_cassette("test_honeytoken_create_with_context_bad_language")
def test_honeytoken_create_with... | result.output | assert | complex_expr | tests/unit/cmd/honeytoken/test_honeytoken_with_context.py | test_honeytoken_create_with_context_bad_language | 70 | null | |
GitGuardian/ggshield | from pathlib import Path
from uuid import uuid4
from click.testing import CliRunner
from ggshield.__main__ import cli
from tests.unit.conftest import assert_invoke_ok, my_vcr
@my_vcr.use_cassette
def test_hmsl_check_random_secret(cli_fs_runner: CliRunner, tmp_path: Path) -> None:
"""
GIVEN a random secret
... | result.output | assert | complex_expr | tests/unit/cmd/hmsl/test_check.py | test_hmsl_check_random_secret | 23 | null | |
GitGuardian/ggshield | import os
from pathlib import Path
from unittest.mock import Mock, patch
import pytest
from click.testing import CliRunner
from ggshield.__main__ import cli
from ggshield.cmd.install import get_default_global_hook_dir_path, install_local
from ggshield.core.errors import ExitCode
from tests.unit.conftest import assert... | result.output | assert | complex_expr | tests/unit/cmd/test_install.py | test_local_exist_is_dir | TestInstallLocal | 32 | null |
GitGuardian/ggshield | import json
import re
from pathlib import Path
from unittest.mock import Mock, patch
import click
import pytest
from ggshield.__main__ import cli
from ggshield.cmd.secret.scan.secret_scan_common_options import (
IGNORED_DEFAULT_WILDCARDS,
)
from ggshield.core.errors import ExitCode
from ggshield.core.filter impor... | 0 | assert | numeric_literal | tests/unit/cmd/scan/test_docker.py | test_docker_scan_archive | TestDockerCMD | 198 | null |
GitGuardian/ggshield | from typing import Optional, Tuple
from unittest.mock import Mock
import pytest
from requests.exceptions import ConnectionError
from ggshield.__main__ import cli
from ggshield.core.config import Config
from ggshield.core.constants import DEFAULT_INSTANCE_URL
from ggshield.core.errors import ExitCode
from ..utils imp... | 3 | assert | numeric_literal | tests/unit/cmd/auth/test_logout.py | test_logout_all | TestAuthLogout | 155 | null |
GitGuardian/ggshield | import json
from datetime import datetime, timezone
from typing import Tuple
import jsonschema
import pytest
from pytest_voluptuous import S
from voluptuous import Any, In
from voluptuous.validators import All, Match
from ggshield.__main__ import cli
from ggshield.core.config import Config
from ggshield.core.config.u... | output | assert | variable | tests/unit/cmd/test_config.py | test_set_lifetime_invalid_value | TestConfigSet | 223 | null |
GitGuardian/ggshield | from pathlib import Path
from tests.conftest import GG_VALID_TOKEN
from tests.functional.utils import recreate_censored_content, run_ggshield_scan
from tests.repository import Repository
def test_scan_commit_range_finds_old_leak(tmp_path: Path) -> None:
# GIVEN a repository
repo = Repository.create(tmp_path)
... | proc.stdout | assert | complex_expr | tests/functional/secret/test_scan_commit_range.py | test_scan_commit_range_finds_old_leak | 42 | null | |
GitGuardian/ggshield | from copy import deepcopy
from operator import itemgetter
from pathlib import Path
from typing import Any, Dict
import yaml
from ggshield.__main__ import cli
from tests.unit.conftest import assert_invoke_ok
V1_CONFIG_CONTENT = """
paths-ignore:
- '**/migrations/**/*'
- '**/snap*'
- '.gitlab/*'
- 'LICENSE'
m... | result.stdout | assert | complex_expr | tests/unit/cmd/test_config_migrate.py | test_config_migrate_cmd | 92 | null | |
GitGuardian/ggshield | from pathlib import Path
from unittest import mock
from ggshield.__main__ import cli
from ggshield.core.errors import ExitCode
from ggshield.core.plugin.client import PluginCatalog, PluginDownloadInfo, PluginInfo
from ggshield.core.plugin.loader import DiscoveredPlugin
class TestPluginUpdate:
def test_update_req... | result.output | assert | complex_expr | tests/unit/cmd/plugin/test_update.py | test_update_requires_plugin_or_all_or_check | TestPluginUpdate | 26 | null |
GitGuardian/ggshield | import importlib.metadata
import json
import sys
from pathlib import Path
from unittest.mock import MagicMock, patch
from ggshield.core.config.enterprise_config import EnterpriseConfig, PluginConfig
from ggshield.core.plugin.base import GGShieldPlugin, PluginMetadata
from ggshield.core.plugin.loader import (
Plugi... | {} | assert | collection | tests/unit/core/plugin/test_loader.py | test_load_enabled_plugins_empty | TestPluginLoader | 113 | null |
GitGuardian/ggshield | from unittest import mock
from ggshield.__main__ import cli
from ggshield.core.errors import ExitCode
from ggshield.core.plugin.client import PluginCatalog, PluginInfo
class TestPluginStatus:
def test_status_shows_plan(self, cli_fs_runner):
"""
GIVEN a user with an account
WHEN running 'g... | result.output | assert | complex_expr | tests/unit/cmd/plugin/test_status.py | test_status_shows_plan | TestPluginStatus | 54 | null |
GitGuardian/ggshield | import logging
import os
import platform
import subprocess
import tarfile
from io import BytesIO
from pathlib import Path
from typing import Optional
from unittest.mock import Mock, patch
import pytest
from ggshield.core.tar_utils import tar_from_ref_and_filepaths
from ggshield.utils.git_shell import (
GitExecuta... | "foo" | assert | string_literal | tests/unit/utils/test_git_shell.py | test_get_default_branch_without_remote | 640 | null | |
GitGuardian/ggshield | import codecs
from pathlib import Path
from random import randrange
import charset_normalizer
import pytest
from ggshield.core.scan import DecodeError, File
from ggshield.core.scan.file import create_files_from_paths
from tests.conftest import is_windows
UNICODE_TEST_CONTENT = "Ascii 123, accents: éèà, hiragana: ぁ, ... | "utf_8" | assert | string_literal | tests/unit/core/scan/test_file.py | test_file_is_longer_than_does_not_read_utf8_file | 105 | null | |
GitGuardian/ggshield | from unittest.mock import patch
from ggshield.core.ui.client_callbacks import (
RATE_LIMIT_MESSAGE_MINIMUM_INTERVAL,
ClientCallbacks,
)
@patch("ggshield.core.ui.display_warning")
def test_on_rate_limited_debouncing(display_warning):
"""
GIVEN a ClientCallbacks instance
WHEN on_rate_limited() is ca... | message | assert | variable | tests/unit/core/ui/test_client_callbacks.py | test_on_rate_limited_debouncing | 25 | null | |
GitGuardian/ggshield | from typing import Any, Dict, List, Union
import pytest
from click.testing import CliRunner
from pytest_voluptuous import S
from ggshield.__main__ import cli
from ggshield.core.errors import ExitCode
from tests.unit.conftest import assert_invoke_exited_with, assert_invoke_ok, my_vcr
from tests.unit.request_mock impor... | result.stdout | assert | complex_expr | tests/unit/cmd/honeytoken/test_honeytoken.py | test_honeytoken_create_error_403 | 176 | null | |
GitGuardian/ggshield | import json
import urllib.parse as urlparse
from datetime import datetime, timedelta, timezone
from enum import IntEnum, auto
from typing import Optional, Set
from unittest.mock import Mock
import pytest
from ggshield.__main__ import cli
from ggshield.core.config import Config
from ggshield.core.constants import DEFA... | 0 | assert | numeric_literal | tests/unit/cmd/auth/test_login.py | test_auth_login_token_default_instance | TestAuthLoginToken | 129 | null |
GitGuardian/ggshield | import json
import urllib.parse as urlparse
from datetime import datetime, timedelta, timezone
from enum import IntEnum, auto
from typing import Optional, Set
from unittest.mock import Mock
import pytest
from ggshield.__main__ import cli
from ggshield.core.config import Config
from ggshield.core.constants import DEFA... | result) | assert_* | variable | tests/unit/cmd/auth/test_login.py | test_auth_login_token_default_instance | TestAuthLoginToken | 139 | null |
GitGuardian/ggshield | from unittest.mock import MagicMock, patch
import pytest
import requests
from ggshield.core.plugin.client import (
PluginAPIClient,
PluginAPIError,
PluginCatalog,
PluginDownloadInfo,
PluginInfo,
PluginNotAvailableError,
)
from ggshield.core.plugin.platform import PlatformInfo
class TestPlugin... | True | assert | bool_literal | tests/unit/core/plugin/test_client.py | test_is_platform_supported_no_restrictions | TestPluginInfo | 32 | null |
GitGuardian/ggshield | import json
from datetime import datetime, timezone
from typing import Tuple
import jsonschema
import pytest
from pytest_voluptuous import S
from voluptuous import Any, In
from voluptuous.validators import All, Match
from ggshield.__main__ import cli
from ggshield.core.config import Config
from ggshield.core.config.u... | value | assert | variable | tests/unit/cmd/test_config.py | test_set_lifetime_default_config_value | TestConfigSet | 149 | null |
GitGuardian/ggshield | import json
import urllib.parse as urlparse
from datetime import datetime, timedelta, timezone
from enum import IntEnum, auto
from typing import Optional, Set
from unittest.mock import Mock
import pytest
from ggshield.__main__ import cli
from ggshield.core.config import Config
from ggshield.core.constants import DEFA... | 2 | assert | numeric_literal | tests/unit/cmd/auth/test_login.py | test_auth_login_token_update_existing_config | TestAuthLoginToken | 261 | null |
GitGuardian/ggshield | import os
from typing import Type
from unittest.mock import Mock, patch
import click
import pytest
import requests.exceptions
from pyfakefs.fake_filesystem import FakeFilesystem
from pygitguardian import GGClient
from pygitguardian.models import APITokensResponse, Detail, TokenScope
from ggshield.core.client import (... | True | assert | bool_literal | tests/unit/core/test_client.py | test_create_session_with_self_signed_option | 279 | null | |
GitGuardian/ggshield | import os
import sys
from copy import deepcopy
from enum import IntEnum
from pathlib import Path
from typing import Optional
import pytest
from click import UsageError
from ggshield.core.config import AccountConfig, Config, InstanceConfig
from ggshield.core.config.utils import get_auth_config_filepath, load_yaml_dict... | err | assert | variable | tests/unit/core/config/test_config.py | test_v1_in_api_url_env | TestConfig | 243 | null |
GitGuardian/ggshield | import subprocess
from pathlib import Path
from typing import Callable, List, Tuple
import pytest
from ggshield.core.filter import init_exclusion_regexes
from ggshield.core.scan import Commit
from ggshield.utils.git_shell import Filemode
from tests.conftest import is_windows
from tests.repository import Repository
P... | stdout | assert | variable | tests/unit/core/scan/test_commit.py | test_from_merge | 495 | null | |
GitGuardian/ggshield | from pathlib import Path
from subprocess import CalledProcessError
import pytest
from tests.conftest import GG_VALID_TOKEN
from tests.functional.utils import recreate_censored_content, run_ggshield
from tests.repository import Repository
def test_scan_precommit(tmp_path: Path) -> None:
# GIVEN a repository
r... | stderr | assert | variable | tests/functional/secret/test_scan_precommit.py | test_scan_precommit | 31 | null | |
GitGuardian/ggshield | import json
import urllib.parse as urlparse
from datetime import datetime, timedelta, timezone
from enum import IntEnum, auto
from typing import Optional, Set
from unittest.mock import Mock
import pytest
from ggshield.__main__ import cli
from ggshield.core.config import Config
from ggshield.core.constants import DEFA... | 1 | assert | numeric_literal | tests/unit/cmd/auth/test_login.py | test_auth_login_token_default_instance | TestAuthLoginToken | 140 | null |
GitGuardian/ggshield | import json
import urllib.parse as urlparse
from datetime import datetime, timedelta, timezone
from enum import IntEnum, auto
from typing import Optional, Set
from unittest.mock import Mock
import pytest
from ggshield.__main__ import cli
from ggshield.core.config import Config
from ggshield.core.constants import DEFA... | token | assert | variable | tests/unit/cmd/auth/test_login.py | test_auth_login_token_default_instance | TestAuthLoginToken | 145 | null |
GitGuardian/ggshield | import subprocess
from pathlib import Path
import pytest
from ggshield.__main__ import cli
from ggshield.cmd.secret.scan.precommit import (
check_is_merge_with_conflict,
check_is_merge_without_conflict,
get_merge_branch_from_reflog,
)
from ggshield.utils.os import cd
from tests.repository import Repositor... | "master" | assert | string_literal | tests/unit/cmd/scan/test_precommit.py | test_get_merge_branch_from_reflog | 103 | null | |
GitGuardian/ggshield | import json
import os
from pathlib import Path
import pytest
import yaml
from ggshield.core.cache import Cache
from ggshield.core.config import Config
from ggshield.core.types import IgnoredMatch
from ggshield.utils.git_shell import is_gitignored
from ggshield.utils.os import cd
from tests.repository import Repositor... | [] | assert | collection | tests/unit/core/test_cache.py | test_defaults | TestCache | 20 | null |
GitGuardian/ggshield | from typing import Dict, Optional
from unittest.mock import Mock, patch
import pytest
from ggshield.core.env_utils import TRACKED_ENV_VARS, load_dot_env
from ggshield.utils.os import cd
@pytest.mark.parametrize("env_var", sorted(TRACKED_ENV_VARS))
def test_load_dot_env_returns_set_vars(env_var, tmp_path, monkeypatch... | {env_var} | assert | collection | tests/unit/core/test_env_utils.py | test_load_dot_env_returns_set_vars | 101 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.