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 |
|---|---|---|---|---|---|---|---|---|---|
se2p/pynguin | from unittest.mock import MagicMock
import pynguin.configuration as config
import pynguin.testcase.statement as stmt
import pynguin.testcase.variablereference as vr
import pynguin.utils.generic.genericaccessibleobject as gao
from tests.testutils import feed_typesystem
def test_statement_replace(field_mock, default_te... | new | assert | variable | tests/testcase/statements/test_fieldstatement.py | test_statement_replace | 67 | null | |
se2p/pynguin | from unittest.mock import MagicMock
import pytest
import pynguin.testcase.variablereference as vr
import pynguin.utils.generic.genericaccessibleobject as gao
from pynguin.testcase.statement import AssignmentStatement
def assignment_statement(test_case_mock) -> AssignmentStatement:
lhs = vr.FieldReference(
... | rhs | assert | variable | tests/testcase/statements/test_assignmentstatement.py | test_rhs | 29 | null | |
se2p/pynguin | import importlib
import json
import tempfile
import typing
from logging import Logger
from pathlib import Path
from unittest.mock import MagicMock
import pynguin.configuration as config
import pynguin.ga.generationalgorithmfactory as gaf
from pynguin.analyses.module import generate_test_cluster
from pynguin.analyses.t... | list | assert | variable | tests/utils/test_typeevalpy_integration.py | test_type_conversion | 198 | null | |
se2p/pynguin | import enum
from unittest import mock
from unittest.mock import MagicMock
import pytest
import pynguin.configuration as config
import pynguin.testcase.statement as stmt
import pynguin.testcase.testcase as tc
import pynguin.testcase.variablereference as vr
from pynguin.analyses.constants import (
ConstantPool,
... | prev | assert | variable | tests/testcase/statements/test_primitivestatements.py | test_enum_statement_delta | 676 | null | |
se2p/pynguin | import pytest
import queue_example as module_0
def test_case_0():
bool_0 = True
queue_0 = module_0.Queue(bool_0)
assert (
f"{type(queue_0).__module__}.{type(queue_0).__qualname__}"
== "queue_example.Queue"
)
assert queue_0.max is True
assert queue_0.head == 0
assert ... | 1 | assert | numeric_literal | docs/source/_static/test_queue_example.py | test_case_0 | 28 | null | |
se2p/pynguin | from __future__ import annotations
import functools
import inspect
import logging
import re
import types
import typing
from abc import ABC, abstractmethod
from collections import Counter, defaultdict
from dataclasses import dataclass, field
from itertools import starmap
from typing import ( # type: ignore[attr-define... | None | assert | none_literal | src/pynguin/analyses/typesystem.py | _guess_from_argument_types_from_path | InferredSignature | 1,464 | null |
se2p/pynguin | import builtins
from unittest.mock import Mock
from pynguin.large_language_model.parsing.type_str_parser import TypeStrParser
def test_parse_simple_types():
"""Test parsing simple types."""
mock_type_system = create_mock_type_system()
parser = TypeStrParser(mock_type_system)
result = parser.parse("int... | int | assert | variable | tests/large_language_model/parsing/test_type_str_parser.py | test_parse_simple_types | 117 | null | |
se2p/pynguin | import importlib
import json
import tempfile
import typing
from logging import Logger
from pathlib import Path
from unittest.mock import MagicMock
import pynguin.configuration as config
import pynguin.ga.generationalgorithmfactory as gaf
from pynguin.analyses.module import generate_test_cluster
from pynguin.analyses.t... | str | assert | variable | tests/utils/test_typeevalpy_integration.py | test_typeevalpy_provider_return_types | 91 | null | |
se2p/pynguin | import ast
from unittest.mock import MagicMock, patch
import pytest
import pynguin.testcase.variablereference as vr
from pynguin.large_language_model.parsing.astscoping import (
FreeVariableOperator,
VariableRefAST,
VariableReferenceVisitor,
copy_and_operate_on_variable_references,
operate_on_fre... | [] | assert | collection | tests/large_language_model/parsing/test_astscoping.py | test_variable_reference_visitor_generic_visit_list_with_none | 108 | null | |
se2p/pynguin | import importlib
import json
import tempfile
import typing
from logging import Logger
from pathlib import Path
from unittest.mock import MagicMock
import pynguin.configuration as config
import pynguin.ga.generationalgorithmfactory as gaf
from pynguin.analyses.module import generate_test_cluster
from pynguin.analyses.t... | int | assert | variable | tests/utils/test_typeevalpy_integration.py | test_typeevalpy_provider_parameter_types | 63 | null | |
se2p/pynguin | from logging import Logger
from unittest.mock import MagicMock
import pytest
import pynguin.configuration as config
import pynguin.ga.generationalgorithmfactory as gaf
import pynguin.ga.testsuitechromosome as tsc
import pynguin.testcase.statement as stmt
import pynguin.testcase.testcase as tc
from pynguin.analyses.mo... | len(result) | assert | func_call | tests/ga/algorithms/test_randomalgorithm.py | test_random_test_cases_no_bounds | 84 | null | |
se2p/pynguin | from __future__ import annotations
import ast
import importlib
from typing import TYPE_CHECKING
from unittest import mock
from unittest.mock import MagicMock
import pytest
import pynguin.ga.coveragegoals as bg
import pynguin.ga.testcasechromosome as tcc
import pynguin.testcase.defaulttestcase as dtc
import pynguin.u... | True | assert | bool_literal | tests/ga/test_coveragegoals.py | test_non_root_branch_coverage_goal | 55 | null | |
se2p/pynguin | from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import MagicMock
import pytest
import pynguin.ga.computations as ff
def cache():
return ff.ComputationCache(MagicMock())
def test_computation_cache_clone(cache):
func = MagicMock()
func.is_maximisation_function.retur... | 0 | assert | numeric_literal | tests/ga/test_computations_cache.py | test_computation_cache_clone | 63 | null | |
se2p/pynguin | from typing import Any
from unittest.mock import MagicMock
import pytest
import pynguin.testcase.statement as stmt
import pynguin.testcase.variablereference as vr
import pynguin.utils.generic.genericaccessibleobject as gao
from pynguin.testcase.variablereference import Reference, VariableReference
from pynguin.utils ... | int | assert | variable | tests/testcase/variable/test_variablereference.py | test_type | 49 | null | |
se2p/pynguin | import enum
import math
import sys
from types import NoneType
from unittest.mock import MagicMock
import pytest
import pynguin.configuration as config
from pynguin.analyses.typesystem import ANY, TypeInfo
from pynguin.testcase.llmlocalsearch import LLMLocalSearch
from pynguin.testcase.localsearch import TestCaseLocal... | size | assert | variable | tests/testcase/test_localsearch.py | test_dict_remove | 989 | null | |
se2p/pynguin | import operator
from pathlib import Path
from unittest import mock
from unittest.mock import MagicMock
import pytest
import pynguin.configuration as config
import pynguin.ga.testcasefactory as tcf
import pynguin.testcase.defaulttestcase as dtc
import pynguin.testcase.testfactory as tf
from pynguin.analyses import se... | 0 | assert | numeric_literal | tests/analyses/test_initialpopulationseeding.py | test_not_working_cases | 182 | null | |
se2p/pynguin | import importlib.util
from pathlib import Path
import pytest
from pynguin.configuration import ToCoverConfiguration
from pynguin.instrumentation.transformer import ModuleAstInfo
def get_module_path(module_name: str, extension: str = ".py") -> str:
"""Return absolute path to a module.
It requires the module ... | {8} | assert | collection | tests/instrumentation/test_ast_info.py | test_ast_info_from_covered_function_only_cover | 113 | null | |
se2p/pynguin | import math
import numpy as np
import pytest
import pynguin.utils.pynguinml.ml_parsing_utils as mlpu
from pynguin.utils.exceptions import ConstraintValidationError
def mock_config(monkeypatch):
def set_mock(**kwargs):
for attr, value in kwargs.items():
monkeypatch.setattr(mlpu.config.configur... | "*3" | assert | string_literal | tests/utils/pynguinml/test_ml_parsing_utils.py | test_parse_var_dependency_with_split_string | 77 | null | |
se2p/pynguin | import ast
import importlib
import tempfile
from pathlib import Path
from unittest import mock
import pytest
import pynguin.configuration as config
import pynguin.ga.generationalgorithmfactory as gaf
import pynguin.ga.testcasechromosome as tcc
import pynguin.generator as gen
from pynguin.analyses.constants import Emp... | text | assert | variable | tests/testcase/export/test_export.py | test_to_module_with_seed_emits_patch_preamble_and_fixture | 566 | null | |
se2p/pynguin | import ast
import inspect
from pynguin.assertion.mutation_analysis.operators.exception import (
ExceptionHandlerDeletion,
ExceptionSwallowing,
)
from tests.testutils import assert_mutation
def test_raise_no_deletion():
asse | {}) | assert_* | collection | tests/assertion/mutation_analysis/operators/test_exception.py | test_raise_no_deletion | 80 | null | |
se2p/pynguin | import json
from unittest.mock import MagicMock
import pytest
import pynguin.configuration as config
import pynguin.ga.chromosome as chrom
import pynguin.ga.computations as ff
import pynguin.ga.testsuitechromosome as tsc
import pynguin.utils.statistics.stats as stat
from pynguin.utils.statistics.runtimevariable impor... | "" | assert | string_literal | tests/utils/stats/test_searchstatistics.py | test_write_statistics_with_individual | 91 | null | |
se2p/pynguin | from __future__ import annotations
import abc
import ast
import copy
import enum
import logging
import math
import typing
from abc import abstractmethod
from pathlib import Path
from typing import TYPE_CHECKING, Any, ClassVar, Generic, TypeVar, cast
import pynguin.assertion.assertion as ass
import pynguin.configurati... | 2 | assert | numeric_literal | src/pynguin/testcase/statement.py | _replacement_supplier | DictStatement | 1,072 | null |
se2p/pynguin | from __future__ import annotations
import io
import logging
from typing import TYPE_CHECKING
import pytest
from pynguin.cli import _setup_logging # noqa: PLC2701
from pynguin.utils.logging_utils import OptionalWorkerFormatter, WorkerFormatting
def _make_isolated_logger(name: str) -> logging.Logger:
"""Create a... | "bye" | assert | string_literal | tests/utils/test_logging_utils.py | test_worker_formatting_injects_tag_and_restores_factory | 80 | null | |
se2p/pynguin | import ast
import importlib
import threading
from queue import Empty
from unittest.mock import MagicMock, patch
import pytest
import pynguin.configuration as config
from pynguin.analyses.constants import EmptyConstantProvider
from pynguin.analyses.module import generate_test_cluster
from pynguin.analyses.seeding impo... | prov | assert | variable | tests/testcase/execution/test_testcaseexecutor_integration.py | test_module_provider | 108 | null | |
se2p/pynguin | import inspect
import operator
import re
from typing import Any, TypeVar, Union
from unittest import mock
import pytest
import pynguin.configuration as config
from pynguin.analyses.module import generate_test_cluster
from pynguin.analyses.type_inference import HintInference, NoInference
from pynguin.analyses.typesyst... | "<?>" | assert | string_literal | tests/analyses/test_typesystem.py | test_unsupported_str | 274 | null | |
se2p/pynguin | import ast
import importlib
import inspect
import logging
import astroid
import pytest
from astroid.nodes import Module
from pynguin.analyses import syntaxtree
from pynguin.analyses.syntaxtree import (
FunctionAnalysisVisitor,
astroid_to_ast,
get_class_node_from_ast,
get_function_description,
get_... | {} | assert | collection | tests/analyses/test_syntaxtree.py | test_add_exception_with_named_exception | 490 | null | |
se2p/pynguin | from unittest import mock
import pytest
import pynguin.configuration as config
from pynguin.ga.chromosomefactory import ChromosomeFactory
from pynguin.ga.llmtestsuitechromosomefactory import LLMTestSuiteChromosomeFactory
from pynguin.ga.testcasechromosome import TestCaseChromosome
from pynguin.ga.testsuitechromosome ... | [] | assert | collection | tests/ga/test_llmtestsuitechromosomefactory.py | test_generate_llm_test_cases_without_results | 99 | null | |
se2p/pynguin | from unittest import mock
from unittest.mock import MagicMock
from pynguin.utils.mutation_utils import alpha_exponent_insertion
def test_alpha_exponent_insertion_none():
insert = []
with mock.patch("pynguin.utils.randomness.next_float") as float_mock:
float_mock.return_value = 0.2
func = Magic... | [] | assert | collection | tests/utils/test_mutation_utils.py | test_alpha_exponent_insertion_none | 32 | null | |
se2p/pynguin | import ast
import inspect
from pynguin.assertion.mutation_analysis.operators.arithmetic import (
ArithmeticOperatorDeletion,
ArithmeticOperatorReplacement,
)
from tests.testutils import assert_mutation
def test_augmented_assign_ignore():
asse | {}) | assert_* | collection | tests/assertion/mutation_analysis/operators/test_arithmetic.py | test_augmented_assign_ignore | 240 | null | |
se2p/pynguin | import pytest
from pynguin.utils.exceptions import (
ConfigurationException,
ConstructionFailedException,
GenerationException,
)
def test_raise_test_generation_exception_with_message():
with pytest.raises(GenerationException) as exception:
raise GenerationException("foo")
assert exception... | "foo" | assert | string_literal | tests/utils/test_exceptions.py | test_raise_test_generation_exception_with_message | 34 | null | |
se2p/pynguin | from __future__ import annotations
import ast
from unittest.mock import MagicMock, Mock
import pytest
import pynguin.testcase.statement as stmt
import pynguin.testcase.variablereference as vr
from pynguin.large_language_model.parsing.astscoping import VariableRefAST
from pynguin.testcase.defaulttestcase import Defau... | refs | assert | variable | tests/testcase/test_ast_assign_statement.py | test_ast_assign_statement_get_variable_references | 133 | null | |
se2p/pynguin | from __future__ import annotations
import importlib.util
import sys
from dataclasses import dataclass
from types import CodeType
from typing import TYPE_CHECKING, Any
from bytecode.cfg import BasicBlock
from bytecode.instr import (
_UNSET, # noqa: PLC2701
UNSET,
CellVar,
FreeVar,
Instr,
TryEn... | arg | assert | variable | tests/slicer/util.py | assert_slice_equal | 121 | null | |
se2p/pynguin | import argparse
import importlib
import logging
import os
import re
from pathlib import Path
from unittest import mock
from unittest.mock import MagicMock, call
import pytest
import pynguin.configuration as config
from pynguin.cli import (
_DANGER_ENV, # noqa: PLC2701
_create_argument_parser, # noqa: PLC270... | call(args[1:]) | assert | func_call | tests/test_cli.py | test_main_with_argv | 53 | null | |
se2p/pynguin | import importlib
import itertools
from logging import Logger
from typing import Union, cast
from unittest.mock import MagicMock, patch
import astroid
import pytest
import pynguin.configuration as config
from pynguin.analyses import module
from pynguin.analyses.generator import GeneratorProvider, RandomGeneratorProvid... | 3 | assert | numeric_literal | tests/analyses/test_module.py | test_analyse_module_dependencies | 129 | null | |
se2p/pynguin | import random
import random as _random
import sys
import types
from pathlib import Path
from unittest import mock
from unittest.mock import MagicMock
import pytest
import pynguin.configuration as config
import pynguin.ga.computations as ff
import pynguin.ga.postprocess as pp
import pynguin.generator as gen
from pyngu... | added | assert | variable | tests/test_generator.py | test__track_one_coverage_while_optimising_for_other | 138 | null | |
se2p/pynguin | test_case: The test case
constructor: The constructor to add to the test case
position: The position where to put the statement in the test case,
defaults to the end of the test case
recursion_depth: A recursion limit for the search of parameter values
... | None | assert | none_literal | src/pynguin/testcase/testfactory.py | change_call | TestFactory | 818 | null |
se2p/pynguin | import datetime
import importlib
import sys
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
import pynguin.__version__ as ver # noqa: PLC2701
import pynguin.configuration as config
from pynguin.instrumentation.machinery import install_import_hook
from pynguin.instrumentation.tracer ... | msg | assert | variable | tests/utils/test_report.py | test_line_annotation_message | 87 | null | |
se2p/pynguin | import ast
import importlib
import inspect
import tempfile
import threading
from pathlib import Path
import pytest
import pynguin.assertion.assertiongenerator as ag
import pynguin.assertion.mutation_analysis.mutators as mu
import pynguin.assertion.mutation_analysis.operators as mo
import pynguin.configuration as conf... | 1 | assert | numeric_literal | tests/assertion/test_assertion_generation_integration.py | test_mutation_analysis_integration_full | 342 | null | |
se2p/pynguin | from unittest import mock
from unittest.mock import MagicMock
import pytest
from pynguin.analyses.generator import (
GeneratorProvider,
RandomGeneratorProvider,
_Generator, # noqa: PLC2701
)
from pynguin.analyses.module import generate_test_cluster
from pynguin.analyses.typesystem import Instance, NoneTy... | 0 | assert | numeric_literal | tests/ga/test_generator.py | test_generator_provider_empty | 157 | null | |
se2p/pynguin | from pathlib import Path
from unittest.mock import MagicMock
import pynguin.configuration as config
from pynguin.utils.statistics.statisticsbackend import (
ConsoleStatisticsBackend,
CSVStatisticsBackend,
OutputVariable,
)
def test_output_variable():
name = "foo"
value = MagicMock(OutputVariable)
... | name | assert | variable | tests/utils/stats/test_statisticsbackend.py | test_output_variable | 22 | null | |
se2p/pynguin | from __future__ import annotations
import abc
import dataclasses
import math
import statistics
from abc import abstractmethod
from typing import TYPE_CHECKING, Any, TypeVar
from pynguin.instrumentation import version
from pynguin.instrumentation.tracer import ExecutionTrace
from pynguin.slicer.dynamicslicer import As... | None | assert | none_literal | src/pynguin/ga/computations.py | _run_test_case_chromosome | TestCaseChromosomeComputation | 59 | null |
se2p/pynguin | import string
import hypothesis.strategies as st
import pytest
from hypothesis import given
from pynguin.utils import randomness
def test_next_bytes_zero():
rand = randomness.next_bytes(0)
assert rand == | b"" | assert | string_literal | tests/utils/test_randomness.py | test_next_bytes_zero | 62 | null | |
se2p/pynguin | from unittest.mock import MagicMock
import pytest
import pynguin.assertion.assertion as ass
import pynguin.testcase.defaulttestcase as dtc
import pynguin.testcase.statement as st
import pynguin.testcase.variablereference as vr
from pynguin.analyses.module import ModuleTestCluster
from pynguin.analyses.typesystem impo... | [] | assert | collection | tests/testcase/test_defaulttestcase.py | test_statements | 214 | null | |
se2p/pynguin | from pathlib import Path
from unittest.mock import MagicMock
import pynguin.configuration as config
from pynguin.utils.statistics.statisticsbackend import (
ConsoleStatisticsBackend,
CSVStatisticsBackend,
OutputVariable,
)
def test_write_data_console_backend(capsys):
data = {
"module": OutputV... | captured.out | assert | complex_expr | tests/utils/stats/test_statisticsbackend.py | test_write_data_console_backend | 51 | null | |
se2p/pynguin | import pytest
import pynguin.utils.typetracing as tt
from pynguin.analyses.constants import (
ConstantPool,
DynamicConstantProvider,
EmptyConstantProvider,
RestrictedConstantPool,
)
from pynguin.utils.orderedset import OrderedSet
def pool() -> ConstantPool:
return ConstantPool()
def rpool() -> Co... | 1 | assert | numeric_literal | tests/analyses/test_constants.py | test_remove_constant | 53 | null | |
se2p/pynguin | import importlib
import itertools
from logging import Logger
from typing import Union, cast
from unittest.mock import MagicMock, patch
import astroid
import pytest
import pynguin.configuration as config
from pynguin.analyses import module
from pynguin.analyses.generator import GeneratorProvider, RandomGeneratorProvid... | 4 | assert | numeric_literal | tests/analyses/test_module.py | test_analyse_module | 123 | null | |
se2p/pynguin | from unittest import mock
from unittest.mock import MagicMock, call
import pytest
import pynguin.configuration as config
import pynguin.ga.testcasechromosome as tcc
import pynguin.testcase.defaulttestcase as dtc
import pynguin.testcase.testfactory as tf
from pynguin.testcase.execution import ExecutionResult
from pyng... | value | assert | variable | tests/ga/test_testcasechromosome.py | test_has_changed | 37 | null | |
se2p/pynguin | from __future__ import annotations
import threading
from decimal import Decimal
from math import inf
from unittest.mock import MagicMock
import pytest
import pynguin.utils.typetracing as tt
from pynguin.instrumentation import PynguinCompare
from pynguin.instrumentation.tracer import (
CodeObjectMetaData,
Exe... | {0} | assert | collection | tests/instrumentation/test_tracer.py | test_default_branchless_code_object | 572 | null | |
se2p/pynguin | import enum
import importlib
import inspect
import re
from inspect import Parameter, Signature
from typing import TYPE_CHECKING, cast
from unittest import mock
from unittest.mock import MagicMock, call, patch
import pytest
import pynguin.configuration as config
import pynguin.testcase.statement as stmt
import pynguin... | [] | assert | collection | tests/testcase/test_testfactory.py | test__get_possible_calls_no_calls | 411 | null | |
se2p/pynguin | import ast
import importlib
from unittest import mock
from unittest.mock import MagicMock, call
import pytest
import pynguin.configuration as config
import pynguin.ga.postprocess as pp
import pynguin.ga.testcasechromosome as tcc
import pynguin.testcase.defaulttestcase as dtc
import pynguin.testcase.statement as stmt
... | 0 | assert | numeric_literal | tests/ga/test_postprocess.py | test_iterative_minimization_visitor_init | 384 | null | |
se2p/pynguin | from unittest.mock import MagicMock
import pytest
import pynguin.assertion.assertion as ass
import pynguin.testcase.defaulttestcase as dtc
import pynguin.testcase.statement as st
import pynguin.testcase.variablereference as vr
from pynguin.analyses.module import ModuleTestCluster
from pynguin.analyses.typesystem impo... | int1 | assert | variable | tests/testcase/test_defaulttestcase.py | test_set_statement_valid | 258 | null | |
se2p/pynguin | import pytest
from pynguin.testcase.execution import ExecutionResult
def execution_result():
return ExecutionResult(timeout=True)
def test_exceptions(execution_result):
ex = Exception()
execution_result.report_new_thrown_exception(0, ex)
assert execution_result.exceptions[0] == | ex | assert | variable | tests/testcase/execution/test_executionresult.py | test_exceptions | 29 | null | |
se2p/pynguin | import pytest
from pynguin.utils.exceptions import ConstraintValidationError
from pynguin.utils.pynguinml.mlparameter import MLParameter, Range
def dtype_map():
return {
"torch.float32": "float32",
"torch.float64": "float64",
"torch.int32": "int32",
"torch.int64": "int64",
}
d... | [] | assert | collection | tests/utils/pynguinml/test_mlparameter.py | test_mlparameter_parse_ndims_invalid | 48 | null | |
se2p/pynguin | from unittest.mock import MagicMock, patch
import pytest
import pynguin.configuration as config
import pynguin.ga.computations as ff
import pynguin.ga.testcasechromosome as tcc
import pynguin.ga.testsuitechromosome as tsc
from pynguin.analyses.generator import HeuristicGeneratorFitnessFunction
from pynguin.analyses.m... | 0 | assert | numeric_literal | tests/ga/test_computations.py | test_test_case_compute_fitness_values | 86 | null | |
se2p/pynguin | from unittest.mock import MagicMock
import hypothesis.strategies as st
import pytest
from hypothesis import given
import pynguin.ga.testsuitechromosome as tsc
from pynguin.ga.stoppingcondition import MinimumCoveragePlateauStoppingCondition, StoppingCondition
def stopping_condition() -> StoppingCondition:
return ... | value | assert | variable | tests/ga/stoppingconditions/test_minimumcoverageplateaustoppingcondition.py | test_set_limit | 79 | null | |
se2p/pynguin | import ast
import inspect
from pynguin.assertion.mutation_analysis.operators.inheritance import (
HidingVariableDeletion,
OverriddenMethodCallingPositionChange,
OverridingMethodDeletion,
SuperCallingDeletion,
SuperCallingInsert,
)
from tests.testutils import assert_mutation
def test_super_call_pos... | {}) | assert_* | collection | tests/assertion/mutation_analysis/operators/test_inheritance.py | test_super_call_position_ignore_when_only_one_statement | 177 | null | |
se2p/pynguin | import string
import hypothesis.strategies as st
import pytest
from hypothesis import given
from pynguin.utils import randomness
@given(st.integers())
def test_set_get_seed(seed):
rng = randomness.Random()
rng.seed(seed)
assert rng.get_seed() == | seed | assert | variable | tests/utils/test_randomness.py | test_set_get_seed | 98 | null | |
se2p/pynguin | from unittest.mock import MagicMock, patch
import pytest
import pynguin.configuration as config
import pynguin.ga.computations as ff
import pynguin.ga.testcasechromosome as tcc
import pynguin.ga.testsuitechromosome as tsc
from pynguin.analyses.generator import HeuristicGeneratorFitnessFunction
from pynguin.analyses.m... | float("inf") | assert | func_call | tests/ga/test_computations.py | test_heuristic_generator_fitness_function_not_connected | 196 | null | |
se2p/pynguin | import pytest
from pynguin.utils.mirror import Mirror
def mirror():
return Mirror()
def test_mirror(mirror):
assert mirror[5] == 5
assert mirror["5"] == | "5" | assert | string_literal | tests/utils/test_mirror.py | test_mirror | 19 | null | |
se2p/pynguin | from __future__ import annotations
from typing import TYPE_CHECKING
import pynguin.configuration as config
import pynguin.ga.chromosome as chrom
import pynguin.testcase.statement as stmt
from pynguin.utils import randomness
class TestCaseChromosome(chrom.Chromosome):
def __init__(
self,
test_cas... | None | assert | none_literal | src/pynguin/ga/testcasechromosome.py | cross_over | TestCaseChromosome | 92 | null |
se2p/pynguin | import ast
from unittest import mock
from unittest.mock import MagicMock
import pynguin.assertion.assertion as ass
import pynguin.assertion.assertiontraceobserver as ato
import pynguin.utils.typetracing as tt
from pynguin.testcase.execution import ExecutionContext, TestCaseExecutor
from pynguin.testcase.statement impo... | clone | assert | variable | tests/assertion/test_assertiontraceobserver.py | test_clone | 41 | null | |
se2p/pynguin | import pytest
import pynguin.utils.typetracing as tt
from pynguin.analyses.constants import (
ConstantPool,
DynamicConstantProvider,
EmptyConstantProvider,
RestrictedConstantPool,
)
from pynguin.utils.orderedset import OrderedSet
def pool() -> ConstantPool:
return ConstantPool()
def rpool() -> Co... | OrderedSet([5]) | assert | func_call | tests/analyses/test_constants.py | test_constant_pool_ignores_proxy | 95 | null | |
se2p/pynguin | import ast
import importlib
import inspect
import subprocess # noqa: S404
import tempfile
import types
from pathlib import Path
import pynguin.utils.generic.genericaccessibleobject as gao
from pynguin.analyses.typesystem import Instance, ProperType, TypeSystem
from pynguin.assertion.mutation_analysis.mutators import ... | dir(operator) | assert | func_call | tests/testutils.py | assert_mutation | 72 | null | |
se2p/pynguin | from unittest import mock
from unittest.mock import MagicMock, call
import pytest
import pynguin.configuration as config
import pynguin.ga.testcasechromosome as tcc
import pynguin.testcase.defaulttestcase as dtc
import pynguin.testcase.testfactory as tf
from pynguin.testcase.execution import ExecutionResult
from pyng... | 1 | assert | numeric_literal | tests/ga/test_testcasechromosome.py | test_get_last_mutatable_statement_mid | 69 | null | |
se2p/pynguin | import math
from unittest.mock import MagicMock
import hypothesis.strategies as st
import pytest
from hypothesis import given
from pynguin.instrumentation.tracer import ExecutionTrace, SubjectProperties
from pynguin.testcase.execution import ExecutionResult
from pynguin.utils.controlflowdistance import ControlFlowDis... | MagicMock() | assert | func_call | tests/utils/test_controlflowdistance.py | test_eq_other_type | 34 | null | |
se2p/pynguin | import ast
import importlib
from unittest import mock
from unittest.mock import MagicMock, call
import pytest
import pynguin.configuration as config
import pynguin.ga.postprocess as pp
import pynguin.ga.testcasechromosome as tcc
import pynguin.testcase.defaulttestcase as dtc
import pynguin.testcase.statement as stmt
... | 1 | assert | numeric_literal | tests/ga/test_postprocess.py | test_unused_primitives_visitor | 207 | null | |
se2p/pynguin | import inspect
import operator
from unittest import mock
from unittest.mock import MagicMock
import pytest
import pynguin.configuration as config
import pynguin.testcase.statement as stmt
import pynguin.testcase.variablereference as vr
from pynguin.analyses.typesystem import AnyType, InferredSignature
from pynguin.ut... | {} | assert | collection | tests/testcase/statements/test_parameterizedstatements.py | test_constructor_statement_no_args | 23 | null | |
se2p/pynguin | from __future__ import annotations
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any
from pynguin.analyses.typesystem import NoneType, is_primitive_type
class StaticFieldReference(Reference):
def __init__(self, field: gao.GenericStaticField):
"""Constructs a new reference to a st... | None | assert | none_literal | src/pynguin/testcase/variablereference.py | get_names | StaticFieldReference | 398 | null |
se2p/pynguin | from __future__ import annotations
import ast
import importlib
from typing import TYPE_CHECKING
from unittest import mock
from unittest.mock import MagicMock
import pytest
import pynguin.ga.coveragegoals as bg
import pynguin.ga.testcasechromosome as tcc
import pynguin.testcase.defaulttestcase as dtc
import pynguin.u... | 8 | assert | numeric_literal | tests/ga/test_coveragegoals.py | test_statement_coverage_goal_creation | 401 | null | |
se2p/pynguin | from __future__ import annotations
import threading
from decimal import Decimal
from math import inf
from unittest.mock import MagicMock
import pytest
import pynguin.utils.typetracing as tt
from pynguin.instrumentation import PynguinCompare
from pynguin.instrumentation.tracer import (
CodeObjectMetaData,
Exe... | {1} | assert | collection | tests/instrumentation/test_tracer.py | test_no_branchless_code_object_register_multiple | 586 | null | |
se2p/pynguin | import pytest
import pynguin.utils.typetracing as tt
from pynguin.analyses.constants import (
ConstantPool,
DynamicConstantProvider,
EmptyConstantProvider,
RestrictedConstantPool,
)
from pynguin.utils.orderedset import OrderedSet
def pool() -> ConstantPool:
return ConstantPool()
def rpool() -> Co... | 2 | assert | numeric_literal | tests/analyses/test_constants.py | test_remove_constant | 51 | null | |
se2p/pynguin | import pytest
import pynguin.configuration as config
from pynguin.large_language_model.llmagent import LLMAgent
from pynguin.large_language_model.prompts.testcasegenerationprompt import (
TestCaseGenerationPrompt,
)
from pynguin.utils.openai_key_resolver import is_api_key_present, require_api_key
def test_is_api_... | True | assert | bool_literal | tests/large_language_model/test_llmagent.py | test_is_api_key_present | 65 | null | |
se2p/pynguin | import importlib
import itertools
from logging import Logger
from typing import Union, cast
from unittest.mock import MagicMock, patch
import astroid
import pytest
import pynguin.configuration as config
from pynguin.analyses import module
from pynguin.analyses.generator import GeneratorProvider, RandomGeneratorProvid... | 6 | assert | numeric_literal | tests/analyses/test_module.py | test_nothing_included_multiple_times | 362 | null | |
se2p/pynguin | from unittest.mock import MagicMock
import pytest
import pynguin.assertion.assertion_trace as at
from pynguin.utils.orderedset import OrderedSet
def assertion_trace():
return at.AssertionTrace()
def test_empty(assertion_trace):
assert assertion_trace.trace == | {} | assert | collection | tests/assertion/test_assertion_trace.py | test_empty | 21 | null | |
se2p/pynguin | import ast
import importlib
import inspect
import logging
import astroid
import pytest
from astroid.nodes import Module
from pynguin.analyses import syntaxtree
from pynguin.analyses.syntaxtree import (
FunctionAnalysisVisitor,
astroid_to_ast,
get_class_node_from_ast,
get_function_description,
get_... | set() | assert | func_call | tests/analyses/test_syntaxtree.py | __assert_none_found | 116 | null | |
se2p/pynguin | from unittest.mock import MagicMock
import pynguin.configuration as config
import pynguin.ga.testcasechromosomefactory as tccf
import pynguin.ga.testsuitechromosome as tsc
import pynguin.ga.testsuitechromosomefactory as tscf
from pynguin.utils.orderedset import OrderedSet
def test_suite_factory_get_chromosome():
... | [] | assert | collection | tests/ga/test_chromosomefactory.py | test_suite_factory_get_chromosome | 30 | null | |
se2p/pynguin | from unittest.mock import MagicMock
import pytest
from pynguin.large_language_model.prompts.uncoveredtargetsprompt import (
UncoveredTargetsPrompt,
)
from pynguin.utils.generic.genericaccessibleobject import (
GenericConstructor,
GenericFunction,
GenericMethod,
)
def module_info():
return {
... | [] | assert | collection | tests/large_language_model/prompts/test_uncovered_targets_prompt.py | test_skips_unknown_callable_type | 95 | null | |
se2p/pynguin | from unittest import mock
import pytest
import pynguin.configuration as config
from pynguin.ga.chromosomefactory import ChromosomeFactory
from pynguin.ga.llmtestsuitechromosomefactory import LLMTestSuiteChromosomeFactory
from pynguin.ga.testcasechromosome import TestCaseChromosome
from pynguin.ga.testsuitechromosome ... | 2 | assert | numeric_literal | tests/ga/test_llmtestsuitechromosomefactory.py | test_get_chromosome_more_llm_tests_than_needed | 167 | null | |
se2p/pynguin | from __future__ import annotations
import importlib.util
import sys
from dataclasses import dataclass
from types import CodeType
from typing import TYPE_CHECKING, Any
from bytecode.cfg import BasicBlock
from bytecode.instr import (
_UNSET, # noqa: PLC2701
UNSET,
CellVar,
FreeVar,
Instr,
TryEn... | name | assert | variable | tests/slicer/util.py | assert_slice_equal | 115 | null | |
se2p/pynguin | import importlib
import sys
from contextlib import contextmanager
import pytest
from pynguin.configuration import ToCoverConfiguration
from pynguin.instrumentation.controlflow import ArtificialNode, ControlDependenceGraph
from pynguin.instrumentation.tracer import SubjectProperties
from pynguin.instrumentation.transf... | graph | assert | variable | tests/instrumentation/test_controldependencegraph.py | test_integration | 53 | null | |
se2p/pynguin | from __future__ import annotations
import logging
from itertools import islice
from typing import TYPE_CHECKING
import pynguin.testcase.testcase as tc
from pynguin.utils.orderedset import OrderedSet
class DefaultTestCase(tc.TestCase): # noqa: PLR0904
_logger = logging.getLogger(__name__)
def accept(self, ... | 0 | assert | numeric_literal | src/pynguin/testcase/defaulttestcase.py | chop | DefaultTestCase | 94 | null |
se2p/pynguin | from pathlib import Path
import pytest
from pynguin.analyses.constants import ConstantPool, collect_static_constants
def fixture_dir():
return Path(__file__).parent / ".." / "fixtures" / "seeding" / "staticconstantseeding"
def test_collect_constants_total(fixture_dir):
constants = collect_static_constants(f... | 7 | assert | numeric_literal | tests/analyses/test_staticconstantseeding.py | test_collect_constants_total | 30 | null | |
se2p/pynguin | import copy
import pytest
from pynguin.utils.orderedset import FrozenOrderedSet, OrderedSet, OrderedTypeSet
def test_ordered_type_set_getitem():
ordered_type_set = OrderedTypeSet([int, float, str])
assert ordered_type_set[0] is int
assert ordered_type_set[1] is float
assert ordered_type_set[2] is | str | assert | variable | tests/utils/test_orderedset.py | test_ordered_type_set_getitem | 189 | null | |
se2p/pynguin | import ast
from unittest import mock
from unittest.mock import MagicMock
import pynguin.assertion.assertion as ass
import pynguin.assertion.assertiontraceobserver as ato
import pynguin.utils.typetracing as tt
from pynguin.testcase.execution import ExecutionContext, TestCaseExecutor
from pynguin.testcase.statement impo... | 1 | assert | numeric_literal | tests/assertion/test_assertiontraceobserver.py | test_check_reference_unwraps_object_proxy | 70 | null | |
se2p/pynguin | from unittest.mock import MagicMock
import pytest
import pynguin.assertion.assertion_trace as at
from pynguin.utils.orderedset import OrderedSet
def assertion_trace():
return at.AssertionTrace()
def test_get_assertions_empty(assertion_trace):
statement = MagicMock()
statement.get_position.return_value =... | OrderedSet() | assert | func_call | tests/assertion/test_assertion_trace.py | test_get_assertions_empty | 57 | null | |
se2p/pynguin | import ast
import importlib
import threading
from queue import Empty
from unittest.mock import MagicMock, patch
import pytest
import pynguin.configuration as config
from pynguin.analyses.constants import EmptyConstantProvider
from pynguin.analyses.module import generate_test_cluster
from pynguin.analyses.seeding impo... | [] | assert | collection | tests/testcase/execution/test_testcaseexecutor_integration.py | test_observers_clear | 102 | null | |
se2p/pynguin | from unittest.mock import MagicMock
import hypothesis.strategies as st
import pytest
from hypothesis import given
import pynguin.ga.testsuitechromosome as tsc
from pynguin.ga.stoppingcondition import CoveragePlateauStoppingCondition
def stopping_condition():
return CoveragePlateauStoppingCondition(50)
def indiv... | value | assert | variable | tests/ga/stoppingconditions/test_coverageplateaustoppingcondition.py | test_set_limit | 57 | null | |
se2p/pynguin | from __future__ import annotations
import logging
import threading
import time
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any
import psutil
import pynguin.ga.searchobserver as so
from pynguin.testcase.execution import (
ExecutionContext,
ExecutionObserver,
ExecutionResult,
... | 0 | assert | numeric_literal | src/pynguin/ga/stoppingcondition.py | __init__ | CoveragePlateauStoppingCondition | 243 | null |
se2p/pynguin | import importlib
import sys
from contextlib import contextmanager
import pytest
from pynguin.configuration import ToCoverConfiguration
from pynguin.instrumentation.controlflow import ArtificialNode, ControlDependenceGraph
from pynguin.instrumentation.tracer import SubjectProperties
from pynguin.instrumentation.transf... | deps | assert | variable | tests/instrumentation/test_controldependencegraph.py | test_get_control_dependencies | 146 | null | |
se2p/pynguin | from unittest.mock import MagicMock
import pytest
import pynguin.assertion.assertion as ass
import pynguin.testcase.defaulttestcase as dtc
import pynguin.testcase.statement as st
import pynguin.testcase.variablereference as vr
from pynguin.analyses.module import ModuleTestCluster
from pynguin.analyses.typesystem impo... | stmt | assert | variable | tests/testcase/test_defaulttestcase.py | test_clone | 210 | null | |
se2p/pynguin | from unittest.mock import MagicMock
import pytest
import pynguin.testcase.variablereference as vr
import pynguin.utils.generic.genericaccessibleobject as gao
from pynguin.testcase.statement import AssignmentStatement
def assignment_statement(test_case_mock) -> AssignmentStatement:
lhs = vr.FieldReference(
... | res | assert | variable | tests/testcase/statements/test_assignmentstatement.py | test_structural_eq_other_different_types | 85 | null | |
se2p/pynguin | import ast
import importlib
import inspect
from unittest.mock import MagicMock
import pytest
import pynguin.configuration as config
import pynguin.ga.testcasechromosome as tcc
import pynguin.ga.testsuitechromosome as tsc
from pynguin.analyses.constants import EmptyConstantProvider
from pynguin.analyses.module import ... | 3 / 6) | pytest.approx | complex_expr | tests/slicer/test_statementslicer.py | test_only_void_function | 157 | null | |
se2p/pynguin | import argparse
import importlib
import logging
import os
import re
from pathlib import Path
from unittest import mock
from unittest.mock import MagicMock, call
import pytest
import pynguin.configuration as config
from pynguin.cli import (
_DANGER_ENV, # noqa: PLC2701
_create_argument_parser, # noqa: PLC270... | 1 | assert | numeric_literal | tests/test_cli.py | test__setup_logging_single_verbose_without_log_file | 136 | null | |
se2p/pynguin | from __future__ import annotations
from unittest.mock import MagicMock, patch
import pytest
import pynguin.assertion.assertion as ass
import pynguin.large_language_model.helpers.testcasereferencecopier as trc
import pynguin.testcase.statement as stmt
import pynguin.testcase.testcase as tc
import pynguin.testcase.var... | 1 | assert | numeric_literal | tests/assertion/test_llmassertiongenerator.py | test_copy_test_case_references | 189 | null | |
se2p/pynguin | from __future__ import annotations
import ast
import importlib
from typing import TYPE_CHECKING
from unittest import mock
from unittest.mock import MagicMock
import pytest
import pynguin.ga.coveragegoals as bg
import pynguin.ga.testcasechromosome as tcc
import pynguin.testcase.defaulttestcase as dtc
import pynguin.u... | 1 | assert | numeric_literal | tests/ga/test_coveragegoals.py | test_compute_fitness_values_no_branches | 183 | null | |
se2p/pynguin | from typing import cast
from unittest.mock import MagicMock
import pytest
import pynguin.assertion.assertion as ass
from pynguin.assertion.assertion import Assertion, AssertionVisitor
from pynguin.testcase import variablereference as vr
def test_reference_assertion_source():
ref = MagicMock()
foo = FooRefere... | ref | assert | variable | tests/assertion/test_assertion.py | test_reference_assertion_source | 34 | null | |
se2p/pynguin | import enum
from unittest import mock
from unittest.mock import MagicMock
import pytest
import pynguin.configuration as config
import pynguin.testcase.statement as stmt
import pynguin.testcase.testcase as tc
import pynguin.testcase.variablereference as vr
from pynguin.analyses.constants import (
ConstantPool,
... | new | assert | variable | tests/testcase/statements/test_primitivestatements.py | test_primitive_statement_replace | 625 | null | |
se2p/pynguin | import ast
import pytest
from pynguin.large_language_model.parsing import rewriter
def test_fixup_result():
"""Test the fixup_result function."""
# Test with valid code (lines 927-928)
valid_code = "def test_func():\n x = 1\n return x"
result = rewriter.fixup_result(valid_code)
assert resul... | {} | assert | collection | tests/large_language_model/test_rewriter.py | test_fixup_result | 235 | null | |
se2p/pynguin | import ast
import pytest
from pynguin.large_language_model.parsing import rewriter
def test_visit_aug_assign():
"""Test the visit_AugAssign method."""
visitor = rewriter.StmtRewriter()
# Test with augmented assignment (lines 362-363, 366)
target = ast.Name(id="x", ctx=ast.Store())
op = ast.Add()... | target.id | assert | complex_expr | tests/large_language_model/test_rewriter.py | test_visit_aug_assign | 355 | null | |
se2p/pynguin | import importlib
import itertools
from logging import Logger
from typing import Union, cast
from unittest.mock import MagicMock, patch
import astroid
import pytest
import pynguin.configuration as config
from pynguin.analyses import module
from pynguin.analyses.generator import GeneratorProvider, RandomGeneratorProvid... | 1 | assert | numeric_literal | tests/analyses/test_module.py | test_analyse_module_dependencies | 128 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.