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 |
|---|---|---|---|---|---|---|---|---|---|
orbingol/NURBS-Python | import pytest
from geomdl import utilities
from geomdl import knotvector
from geomdl import control_points
from geomdl.exceptions import GeomdlException
GEOMDL_DELTA = 10e-6
def test_cpman_curve7():
"""Control Points Manager: get-set attachment (valid, float)"""
d = 13
p = 5
sz = 12
cpman = contro... | 13 | assert | numeric_literal | tests/test_utils.py | test_cpman_curve7 | 201 | null | |
orbingol/NURBS-Python | from pytest import fixture, mark
from geomdl import BSpline
from geomdl import evaluators
from geomdl import convert
from geomdl import helpers
GEOMDL_DELTA = 0.001
def spline_surf():
"""Creates a B-spline surface instance"""
# Create a surface instance
surf = BSpline.Surface()
# Set degrees
surf... | 3 | assert | numeric_literal | tests/test_surface.py | test_bspline_surface_degree_u | 80 | null | |
orbingol/NURBS-Python | from geomdl import BSpline
from geomdl import convert
SAMPLE_SIZE = 5
C_DEGREE = 2
C_CTRLPTS = [[1, 1, 0], [2, 1, -1], [2, 2, 0]]
C_KV = [0, 0, 0, 1, 1, 1]
S_DEGREE_U = 2
S_DEGREE_V = 2
S_CTRLPTS = [[0, 0, 0], [0, 1, 0], [0, 2, -3], [1, 0, 6], [1, 1, 0], [1, 2, 0], [2, 0, 0], [2, 1, 0], [2, 2, 3]]
S_KV_U = [0, 0, 0, ... | res | assert | variable | tests/test_convert.py | test_convert_curve | 40 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import utilities
from geomdl import knotvector
from geomdl import control_points
from geomdl.exceptions import GeomdlException
GEOMDL_DELTA = 10e-6
def test_cpman_curve4():
"""Control Points Manager: get-set attachment (valid, list)"""
d = [0.0, 1.0, 2.0, 3.0]
p = 5
sz = 12
... | 2.0 | assert | numeric_literal | tests/test_utils.py | test_cpman_curve4 | 169 | null | |
orbingol/NURBS-Python | from geomdl import compatibility
P = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
W = [0.5, 2, 1]
PW = [[0.5, 1, 1.5, 0.5], [8, 10, 12, 2], [7, 8, 9, 1]]
PW_ONES = [[1, 2, 3, 1], [4, 5, 6, 1], [7, 8, 9, 1]]
PW_SEP = [[1, 2, 3, 0.5], [4, 5, 6, 2], [7, 8, 9, 1]]
def test_change_ctrlpts_row_order():
size_u = 3
size_v = 4
... | result | assert | variable | tests/test_compatibility.py | test_change_ctrlpts_row_order | 84 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import CPGen
GRID_TOL = 10e-8
def grid():
"""Generates a 3x4 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(3, 4)
return surfgrid
def grid2():
"""Generates a 6x6 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(16, 16)
... | [] | assert | collection | tests/test_surfgen.py | test_grid_reset1 | 96 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import utilities
from geomdl import knotvector
from geomdl import control_points
from geomdl.exceptions import GeomdlException
GEOMDL_DELTA = 10e-6
def test_check_knot_vector5():
degree = 4
num_ctrlpts = 12
with pytest.raises( | TypeError) | pytest.raises | variable | tests/test_utils.py | test_check_knot_vector5 | 81 | null | |
orbingol/NURBS-Python | from pytest import fixture, mark
from geomdl import BSpline
from geomdl import evaluators
from geomdl import convert
from geomdl import helpers
GEOMDL_DELTA = 0.001
def spline_surf():
"""Creates a B-spline surface instance"""
# Create a surface instance
surf = BSpline.Surface()
# Set degrees
surf... | 1.0 | assert | numeric_literal | tests/test_surface.py | test_nurbs_weights | 219 | null | |
orbingol/NURBS-Python | from geomdl import compatibility
P = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
W = [0.5, 2, 1]
PW = [[0.5, 1, 1.5, 0.5], [8, 10, 12, 2], [7, 8, 9, 1]]
PW_ONES = [[1, 2, 3, 1], [4, 5, 6, 1], [7, 8, 9, 1]]
PW_SEP = [[1, 2, 3, 0.5], [4, 5, 6, 2], [7, 8, 9, 1]]
def test_combine_ctrlpts_weights1():
check = compatibility.combi... | check | assert | variable | tests/test_compatibility.py | test_combine_ctrlpts_weights1 | 19 | null | |
orbingol/NURBS-Python | from pytest import fixture, mark
from geomdl import BSpline
from geomdl import evaluators
from geomdl import helpers
from geomdl import convert
from geomdl import operations
GEOMDL_DELTA = 0.001
def spline_curve():
"""Creates a spline Curve"""
curve = BSpline.Curve()
curve.degree = 3
curve.ctrlpts = [... | 0.66 | assert | numeric_literal | tests/test_curve.py | test_bspline_curve2d_insert_knot_kv | 98 | null | |
orbingol/NURBS-Python | from pytest import fixture, mark
from geomdl import BSpline
from geomdl import evaluators
from geomdl import helpers
from geomdl import convert
from geomdl import operations
GEOMDL_DELTA = 0.001
def spline_curve():
"""Creates a spline Curve"""
curve = BSpline.Curve()
curve.degree = 3
curve.ctrlpts = [... | 3 | assert | numeric_literal | tests/test_curve.py | test_bspline_curve_degree | 32 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import CPGen
GRID_TOL = 10e-8
def grid():
"""Generates a 3x4 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(3, 4)
return surfgrid
def grid2():
"""Generates a 6x6 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(16, 16)
... | 0 | assert | numeric_literal | tests/test_surfgen.py | test_grid_reset1 | 97 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import utilities
from geomdl import knotvector
from geomdl import control_points
from geomdl.exceptions import GeomdlException
GEOMDL_DELTA = 10e-6
def test_cpman_curve1():
"""Control Points Manager: get-set point (curve)"""
pt = [0.0, 0.2, 0.3]
p = 3
sz = 10
cpman = cont... | pt | assert | variable | tests/test_utils.py | test_cpman_curve1 | 141 | null | |
orbingol/NURBS-Python | from pytest import fixture, mark
from geomdl import BSpline
from geomdl import evaluators
from geomdl import convert
from geomdl import helpers
GEOMDL_DELTA = 0.001
def spline_surf():
"""Creates a B-spline surface instance"""
# Create a surface instance
surf = BSpline.Surface()
# Set degrees
surf... | c_post | assert | variable | tests/test_surface.py | test_bspline_surface_remove_knot_u | 179 | null | |
orbingol/NURBS-Python | import os
import pytest
from geomdl import BSpline
from geomdl import multi
from geomdl import operations
import matplotlib
matplotlib.use("agg")
from geomdl.visualization import VisMPL
SAMPLE_SIZE = 5
def bspline_curve2d():
"""Creates a 2-dimensional B-Spline curve instance"""
# Create a curve instance
... | 0 | assert | numeric_literal | tests/test_visualization.py | test_curve2d_fig_nowindow | 149 | null | |
orbingol/NURBS-Python | import os
import pytest
from geomdl import BSpline, NURBS
from geomdl import multi
from geomdl import exchange
from geomdl import exchange_vtk
from geomdl import compatibility
from geomdl import operations
FILE_NAME = "testing"
SAMPLE_SIZE = 25
def bspline_curve3d():
"""Creates a B-Spline 3-dimensional curve ins... | 0 | assert | numeric_literal | tests/test_read_write.py | test_export_obj_single | 95 | null | |
orbingol/NURBS-Python | from geomdl import helpers
GEOMDL_DELTA = 10e-8
def test_basis_function_all():
degree = 2
knot_vector = [0, 0, 0, 1, 2, 3, 4, 4, 5, 5, 5]
span = 4
knot = 5.0 / 2.0
to_check = helpers.basis_function_all(degree, knot_vector, span, knot)
interm = [helpers.basis_function(_, knot_vector, span, kno... | result[1][0] | assert | complex_expr | tests/test_helpers.py | test_basis_function_all | 75 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import linalg
GEOMDL_DELTA = 10e-6
def test_vector_multiply():
result = [2, 4, 6]
computed = linalg.vector_multiply((1, 2, 3), 2)
assert result == | computed | assert | variable | tests/test_linalg.py | test_vector_multiply | 196 | null | |
orbingol/NURBS-Python | from pytest import fixture, mark
from geomdl import BSpline
from geomdl import evaluators
from geomdl import helpers
from geomdl import convert
from geomdl import operations
GEOMDL_DELTA = 0.001
def spline_curve():
"""Creates a spline Curve"""
curve = BSpline.Curve()
curve.degree = 3
curve.ctrlpts = [... | c_post | assert | variable | tests/test_curve.py | test_bspline_curve2d_remove_knot | 110 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import utilities
from geomdl import knotvector
from geomdl import control_points
from geomdl.exceptions import GeomdlException
GEOMDL_DELTA = 10e-6
def test_cpman_curve3():
"""Control Points Manager: check for invalid index"""
p = 12
sz = 5
cpman = control_points.CurveManager... | None | assert | none_literal | tests/test_utils.py | test_cpman_curve3 | 157 | null | |
orbingol/NURBS-Python | from geomdl import BSpline
from geomdl import convert
SAMPLE_SIZE = 5
C_DEGREE = 2
C_CTRLPTS = [[1, 1, 0], [2, 1, -1], [2, 2, 0]]
C_KV = [0, 0, 0, 1, 1, 1]
S_DEGREE_U = 2
S_DEGREE_V = 2
S_CTRLPTS = [[0, 0, 0], [0, 1, 0], [0, 2, -3], [1, 0, 6], [1, 1, 0], [1, 2, 0], [2, 0, 0], [2, 1, 0], [2, 2, 3]]
S_KV_U = [0, 0, 0, ... | res_weights | assert | variable | tests/test_convert.py | test_convert_curve | 41 | null | |
orbingol/NURBS-Python | from pytest import fixture, mark
from geomdl import BSpline
from geomdl import evaluators
from geomdl import helpers
from geomdl import convert
from geomdl import operations
GEOMDL_DELTA = 0.001
def spline_curve():
"""Creates a spline Curve"""
curve = BSpline.Curve()
curve.degree = 3
curve.ctrlpts = [... | GEOMDL_DELTA | assert | variable | tests/test_curve.py | test_bspline_curve2d_eval | 51 | null | |
orbingol/NURBS-Python | from geomdl import helpers
GEOMDL_DELTA = 10e-8
def test_basis_function():
degree = 2
knot_vector = [0, 0, 0, 1, 2, 3, 4, 4, 5, 5, 5]
span = 4
knot = 5.0 / 2.0
to_check = helpers.basis_function(degree, knot_vector, span, knot)
result = [1.0 / 8.0, 6.0 / 8.0, 1.0 / 8.0] # Values from The Nurb... | GEOMDL_DELTA | assert | variable | tests/test_helpers.py | test_basis_function | 32 | null | |
orbingol/NURBS-Python | from geomdl import helpers
GEOMDL_DELTA = 10e-8
def test_find_span_binsearch():
degree = 2
knot_vector = [0, 0, 0, 1, 2, 3, 4, 4, 5, 5, 5]
num_ctrlpts = len(knot_vector) - degree - 1
knot = 5.0 / 2.0
to_check = helpers.find_span_binsearch(degree, knot_vector, num_ctrlpts, knot)
result = 4 # ... | result | assert | variable | tests/test_helpers.py | test_find_span_binsearch | 20 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import utilities
from geomdl import knotvector
from geomdl import control_points
from geomdl.exceptions import GeomdlException
GEOMDL_DELTA = 10e-6
def test_generate_knot_vector1():
with pytest.raises( | ValueError) | pytest.raises | variable | tests/test_utils.py | test_generate_knot_vector1 | 16 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import CPGen
GRID_TOL = 10e-8
def grid():
"""Generates a 3x4 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(3, 4)
return surfgrid
def grid2():
"""Generates a 6x6 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(16, 16)
... | 13 | assert | numeric_literal | tests/test_surfgen.py | test_grid_generate5 | 64 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from typing import Any, Callable
from unittest import mock
import pytest
from pytest_bdd import given, parsers, then, when
from pytest_bdd.utils import collect_dumped_objects
def test_step_functions_same_parser(pytester):
pytester.makefile(
".feature",
... | ("str",) | assert | collection | tests/steps/test_common.py | test_step_functions_same_parser | 169 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
def test_step_hooks(pytester):
"""When step fails."""
pytester.makefile(
".feature",
test="""
Feature: StepHandler hooks
Scenario: When step has hook on failure
Given I have a bar
When it fails
Scenario: When step's de... | 2 | assert | numeric_literal | tests/feature/test_steps.py | test_step_hooks | 456 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
import pytest
from pytest_bdd.reporting import test_report_context_registry
def test_step_trace(pytester):
"""Test step trace."""
pytester.makefile(
".ini",
pytest=textwrap.dedent(
"""
[pytest]
markers =
feature-t... | expected | assert | variable | tests/feature/test_report.py | test_step_trace | 146 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
STEPS = """\
from pytest_bdd import given, when, then, parsers
from pytest_bdd.utils import dump_obj
# Using `parsers.re` so that we can match empty values
@given(parsers.re("there are (?P<start>.*?) cucumbers"))... | ["#", "", ""] | assert | collection | tests/feature/test_outline_empty_values.py | test_scenario_with_empty_example_values | 66 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
def test_conftest_module_evaluated_twice(pytester):
"""Regression test for https://github.com/pytest-dev/pytest-bdd/issues/62"""
pytester.makeconftest("")
subdir = pytester.mkpydir("subdir")
subdir... | 1 | assert | numeric_literal | tests/test_hooks.py | test_conftest_module_evaluated_twice | 48 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
def test_uses_correct_step_in_the_hierarchy(pytester):
"""
Test regression found in issue #524, where we couldn't find the correct step implementation in the
hierarchy of files/folder as expected.
T... | thing2 | assert | variable | tests/library/test_parent.py | test_uses_correct_step_in_the_hierarchy | 409 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from typing import Any, Callable
from unittest import mock
import pytest
from pytest_bdd import given, parsers, then, when
from pytest_bdd.utils import collect_dumped_objects
def test_step_function_multiple_target_fixtures(pytester):
pytester.makefile(
... | "test foo" | assert | string_literal | tests/steps/test_common.py | test_step_function_multiple_target_fixtures | 79 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from typing import Any, Callable
from unittest import mock
import pytest
from pytest_bdd import given, parsers, then, when
from pytest_bdd.utils import collect_dumped_objects
def test_user_implements_a_step_generator(pytester):
"""Test advanced use cases, like ... | "assert 9 EUR" | assert | string_literal | tests/steps/test_common.py | test_user_implements_a_step_generator | 319 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from typing import Any, Callable
from unittest import mock
import pytest
from pytest_bdd import given, parsers, then, when
from pytest_bdd.utils import collect_dumped_objects
def test_user_implements_a_step_generator(pytester):
"""Test advanced use cases, like ... | "given 10 EUR" | assert | string_literal | tests/steps/test_common.py | test_user_implements_a_step_generator | 317 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
def test_default_value_is_used_as_fallback(pytester):
"""Test that the default value for a step implementation is only used as a fallback."""
pytester.makefile(
".feature",
simple="""
... | ["defaultuser", "user1"] | assert | collection | tests/feature/test_scenario.py | test_default_value_is_used_as_fallback | 430 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import itertools
import textwrap
from pytest_bdd.scenario import get_python_name_generator
def test_generate_missing_with_step_parsers(pytester):
"""Test that step parsers are correctly discovered and won't be part of the missing steps."""
pytester.makefile(
".featu... | output | assert | variable | tests/generation/test_generate_missing.py | test_generate_missing_with_step_parsers | 142 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
def test_reuse_same_step_different_converters(pytester):
pytester.makefile(
".feature",
arguments=textwrap.dedent(
"""\
Feature: Reuse same step with different converters... | "42" | assert | string_literal | tests/args/test_common.py | test_reuse_same_step_different_converters | 56 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import os
import sys
import textwrap
from pytest_bdd.scripts import main
PATH = os.path.dirname(__file__)
def test_unicode_characters(pytester, monkeypatch):
"""Test generating code with unicode characters.
Primary purpose is to ensure compatibility with Python2.
"""
... | expected_output | assert | variable | tests/scripts/test_generate.py | test_unicode_characters | 216 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import itertools
import textwrap
from pytest_bdd.scenario import get_python_name_generator
def test_python_name_generator():
"""Test python name generator function."""
assert list(itertools.islice(get_python_name_generator("Some name"), 3)) == | [ "test_some_name", "test_some_name_1", "test_some_name_2", ] | assert | collection | tests/generation/test_generate_missing.py | test_python_name_generator | 13 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from typing import Any, Callable
from unittest import mock
import pytest
from pytest_bdd import given, parsers, then, when
from pytest_bdd.utils import collect_dumped_objects
def test_user_implements_a_step_generator(pytester):
"""Test advanced use cases, like ... | "pay 1 EUR" | assert | string_literal | tests/steps/test_common.py | test_user_implements_a_step_generator | 318 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
def test_pytest_unconfigure_without_configure(pytester):
"""
Simulate a plugin forcing an exit during configuration before bdd is configured
https://github.com/pytest-dev/pytest-bdd/issues/362
"""
... | 0 | assert | numeric_literal | tests/test_hooks.py | test_pytest_unconfigure_without_configure | 157 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
def test_reuse_same_step_different_converters(pytester):
pytester.makefile(
".feature",
arguments=textwrap.dedent(
"""\
Feature: Reuse same step with different converters... | int | assert | variable | tests/args/test_common.py | test_reuse_same_step_different_converters | 52 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from typing import Any, Callable
from unittest import mock
import pytest
from pytest_bdd import given, parsers, then, when
from pytest_bdd.utils import collect_dumped_objects
@pytest.mark.parametrize("step_fn, step_type", [(given, "given"), (when, "when"), (then, "... | "foo") | assert_* | string_literal | tests/steps/test_common.py | test_given_when_then_delegate_to_step | 23 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
def test_example_params(pytester):
"""Test example params are rendered where necessary:
* Step names
* Docstring
* Datatables
"""
pytester.makefile(
".feature",
example_param... | [ ("background", "parameter"), ("background_docstring", "Background parameter"), ("datatable", [["table"], ["example"]]), ("docstring", "This is a string"), ] | assert | collection | tests/feature/test_scenario.py | test_example_params | 283 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import os
import sys
import textwrap
from pytest_bdd.scripts import main
PATH = os.path.dirname(__file__)
def test_migrate(monkeypatch, capsys, pytester):
"""Test if the code is migrated by a given file mask."""
tests = pytester.mkpydir("tests")
tests.joinpath("test_f... | textwrap.dedent( ''' """Foo bar tests.""" from pytest_bdd import scenario @scenario('foo_bar.feature', 'Foo bar') def test_foo(): pass ''' ) | assert | func_call | tests/scripts/test_migrate.py | test_migrate | 39 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
def test_pytest_bdd_after_scenario_called_after_scenario(pytester):
"""Regression test for https://github.com/pytest-dev/pytest-bdd/pull/577"""
pytester.makefile(
".feature",
foo=textwrap.d... | "Scenario 1" | assert | string_literal | tests/test_hooks.py | test_pytest_bdd_after_scenario_called_after_scenario | 138 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import os
import sys
import textwrap
from pytest_bdd.scripts import main
PATH = os.path.dirname(__file__)
def test_main(monkeypatch, capsys):
"""Test if main command shows help when called without the subcommand."""
monkeypatch.setattr(sys, "argv", ["pytest-bdd"])
monk... | err | assert | variable | tests/scripts/test_main.py | test_main | 20 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import contextlib
import logging
import os
import re
from collections.abc import Iterable, Iterator
from inspect import signature
from typing import TYPE_CHECKING, Callable, TypeVar, cast
from weakref import WeakKeyDictionary
import pytest
from _pytest.fixtures import FixtureDef, Fi... | None | assert | none_literal | src/pytest_bdd/scenario.py | parse_step_arguments | 191 | null | |
pytest-dev/pytest-bdd | docstring=None,
),
Step(
id="18",
keyword="When",
keyword_type="Action",
location=Location(column=5, lin... | expected_document | assert | variable | tests/parser/test_parser.py | test_parser | 853 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from typing import Any, Callable
from unittest import mock
import pytest
from pytest_bdd import given, parsers, then, when
from pytest_bdd.utils import collect_dumped_objects
def test_step_functions_same_parser(pytester):
pytester.makefile(
".feature",
... | ("re", "testfoo") | assert | collection | tests/steps/test_common.py | test_step_functions_same_parser | 170 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from src.pytest_bdd.utils import collect_dumped_objects
def test_steps_with_docstrings(pytester):
pytester.makefile(
".feature",
docstring=textwrap.dedent(
'''
Feature: Docstring
Scenario: Step with plain do... | ["This is a given docstring", "This is a when docstring", "This is a then docstring"] | assert | collection | tests/steps/test_docstring.py | test_steps_with_docstrings | 82 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import copy
import os.path
import re
import textwrap
from collections import OrderedDict
from collections.abc import Generator, Iterable, Mapping, Sequence
from dataclasses import dataclass, field
from .exceptions import StepError
from .gherkin_parser import Background as GherkinBac... | len(row) | assert | func_call | src/pytest_bdd/parser.py | as_contexts | Examples | 124 | null |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
def test_reuse_same_step_different_converters(pytester):
pytester.makefile(
".feature",
arguments=textwrap.dedent(
"""\
Feature: Reuse same step with different converters... | str | assert | variable | tests/args/test_common.py | test_reuse_same_step_different_converters | 55 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
def test_tags_selector(pytester):
"""Test tests selection by tags."""
pytester.makefile(
".ini",
pytest=textwrap.dedent(
"""
[pytest]
markers =
feature_tag_1
feature_tag_2
scenario_tag_01
sce... | 1 | assert | numeric_literal | tests/feature/test_tags.py | test_tags_selector | 58 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import itertools
import textwrap
from pytest_bdd.scenario import get_python_name_generator
def test_generate_missing(pytester):
"""Test generate missing command."""
pytester.makefile(
".feature",
generation=textwrap.dedent(
"""\
Featu... | 0 | assert | numeric_literal | tests/generation/test_generate_missing.py | test_generate_missing | 72 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
STEPS = """\
from pytest_bdd import parsers, given, when, then
from pytest_bdd.utils import dump_obj
@given(parsers.parse("there are {start:d} cucumbers"), target_fixture="cucumbers")
def _(start):
assert isi... | ["https://my-site.com"] | assert | collection | tests/feature/test_outline.py | test_forward_slash_in_params | 324 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import os
import sys
import textwrap
from pytest_bdd.scripts import main
PATH = os.path.dirname(__file__)
def test_migrate(monkeypatch, capsys, pytester):
"""Test if the code is migrated by a given file mask."""
tests = pytester.mkpydir("tests")
tests.joinpath("test_f... | expected | assert | variable | tests/scripts/test_migrate.py | test_migrate | 38 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
def test_pytest_bdd_after_scenario_called_after_scenario(pytester):
"""Regression test for https://github.com/pytest-dev/pytest-bdd/pull/577"""
pytester.makefile(
".feature",
foo=textwrap.d... | feature_2.name | assert | complex_expr | tests/test_hooks.py | test_pytest_bdd_after_scenario_called_after_scenario | 136 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
STEPS = """\
from pytest_bdd import parsers, given, when, then
from pytest_bdd.utils import dump_obj
@given(parsers.parse("there are {start:d} cucumbers"), target_fixture="cucumbers")
def _(start):
assert isi... | [ 12, 5.0, "7", 5, 4.0, "1", ] | assert | collection | tests/feature/test_outline.py | test_outlined | 77 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
def test_reuse_same_step_different_converters(pytester):
pytester.makefile(
".feature",
arguments=textwrap.dedent(
"""\
Feature: Reuse same step with different converters... | 42.0 | assert | numeric_literal | tests/args/test_common.py | test_reuse_same_step_different_converters | 59 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from typing import Any, Callable
from unittest import mock
import pytest
from pytest_bdd import given, parsers, then, when
from pytest_bdd.utils import collect_dumped_objects
def test_step_function_multiple_target_fixtures(pytester):
pytester.makefile(
... | "test bar" | assert | string_literal | tests/steps/test_common.py | test_step_function_multiple_target_fixtures | 80 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from pytest_bdd.utils import collect_dumped_objects
def test_pytest_bdd_after_scenario_called_after_scenario(pytester):
"""Regression test for https://github.com/pytest-dev/pytest-bdd/pull/577"""
pytester.makefile(
".feature",
foo=textwrap.d... | "Scenario 2" | assert | string_literal | tests/test_hooks.py | test_pytest_bdd_after_scenario_called_after_scenario | 139 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from src.pytest_bdd.utils import collect_dumped_objects
def test_steps_with_datatables(pytester):
pytester.makefile(
".feature",
datatable=textwrap.dedent(
"""\
Feature: Manage user accounts
Scenario: Creati... | [ ["name", "email", "age"], ["John", "john@example.com", "30"], ["Alice", "alice@example.com", "25"], ] | assert | collection | tests/datatable/test_datatable.py | test_steps_with_datatables | 84 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import json
import os.path
import textwrap
from typing import TYPE_CHECKING, Any
def runandparse(pytester: Pytester, *args: Any) -> tuple[RunResult, list[dict[str, Any]]]:
"""Run tests in testdir and parse json output."""
resultpath = pytester.path.joinpath("cucumber.json")
... | expected | assert | variable | tests/feature/test_cucumber_json.py | test_step_trace | 239 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from src.pytest_bdd.utils import collect_dumped_objects
def test_steps_with_datatables(pytester):
pytester.makefile(
".feature",
datatable=textwrap.dedent(
"""\
Feature: Manage user accounts
Scenario: Creati... | [ ["permission", "allowed"], ["view dashboard", "true"], ["edit content", "true"], ["delete content", "false"], ] | assert | collection | tests/datatable/test_datatable.py | test_steps_with_datatables | 94 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
from typing import Any, Callable
from unittest import mock
import pytest
from pytest_bdd import given, parsers, then, when
from pytest_bdd.utils import collect_dumped_objects
def test_step_catches_all(pytester):
"""Test that the @step(...) decorator works for a... | ["foo", ("foo parametrized", 1), "foo", ("foo parametrized", 2), "foo", ("foo parametrized", 3)] | assert | collection | tests/steps/test_common.py | test_step_catches_all | 362 | null | |
pytest-dev/pytest-bdd | from __future__ import annotations
import textwrap
def test_tags_selector(pytester):
"""Test tests selection by tags."""
pytester.makefile(
".ini",
pytest=textwrap.dedent(
"""
[pytest]
markers =
feature_tag_1
feature_tag_2
scenario_tag_01
sce... | 2 | assert | numeric_literal | tests/feature/test_tags.py | test_tags_selector | 66 | null | |
pajbot/pajbot | from pajbot.apiwrappers.base import BaseAPI
def test_string_endpoint_no_leading_slash():
assert BaseAPI.join_base_and_endpoint("https://example.com/v1/", "test/def") == | "https://example.com/v1/test/def" | assert | string_literal | pajbot/tests/apiwrappers/test_join_base_and_endpoint.py | test_string_endpoint_no_leading_slash | 5 | null | |
pajbot/pajbot | def test_find_unique_urls() -> None:
from pajbot.modules.linkchecker import find_unique_urls
assert find_unique_urls("pajlada.se test http://pajlada.se") == {"http://pajlada.se"}
assert find_unique_urls("pajlada.se pajlada.com foobar.se") == {
"http://pajlada.se",
"http://pajlada.com",
... | {"http://foobar.com"} | assert | collection | pajbot/tests/test_url_parser.py | test_find_unique_urls | 40 | null | |
pajbot/pajbot | import os
from pajbot.apiwrappers.seventv import SevenTVAPI
def test_seventv_fetch_channel_emotes_has_emotes():
"""
The user pajlada (User ID 11148817) have signed up to 7TV and
have added emotes.
"""
if os.getenv("PAJBOT_RUN_INTEGRATION_TESTS", "0") != "1":
return
redis = None
a... | 0 | assert | numeric_literal | pajbot/tests/apiwrappers/test_seventv_channel_emotes.py | test_seventv_fetch_channel_emotes_has_emotes | 20 | null | |
pajbot/pajbot | import os
from pajbot.apiwrappers.seventv import SevenTVAPI
def test_seventv_fetch_global_emotes():
if os.getenv("PAJBOT_RUN_INTEGRATION_TESTS", "0") != "1":
return
redis = None
api = SevenTVAPI(redis)
emotes = api.fetch_global_emotes()
assert len(emotes) > | 0 | assert | numeric_literal | pajbot/tests/apiwrappers/test_seventv_global_emotes.py | test_seventv_fetch_global_emotes | 15 | null | |
pajbot/pajbot | def test_clean_up() -> None:
from pajbot.utils import clean_up_message
assert "" == "\U000e0000"
assert "" == clean_up_message("")
assert "" == | clean_up_message(" ") | assert | func_call | pajbot/tests/test_clean_up_message.py | test_clean_up | 7 | null | |
pajbot/pajbot | from pajbot.apiwrappers.base import BaseAPI
def test_fills_in_relative_url():
assert BaseAPI.fill_in_url_scheme("//example.com") == | "https://example.com" | assert | string_literal | pajbot/tests/apiwrappers/test_fill_in_url_scheme.py | test_fills_in_relative_url | 5 | null | |
pajbot/pajbot | from pajbot.modules.bingo import join_to_sentence
def test_length_three():
assert join_to_sentence(["asd", "def", "KKona"]) == | "asd, def and KKona" | assert | string_literal | pajbot/tests/modules/test_join_to_sentence.py | test_length_three | 17 | null | |
pajbot/pajbot | def test_command_permission_mod_only():
from pajbot.models.command import Command
tests = [
[
"User with level 100 can execute command with level 100",
Command(mod_only=False, level=100), # Command to test agains
User(False, 100), # User to test with
Tr... | expected_result | assert | variable | pajbot/tests/test_commands.py | test_command_permission_mod_only | 95 | null | |
pajbot/pajbot | from pajbot.apiwrappers.base import BaseAPI
def test_list_endpoint_with_int_path_segment():
assert ( | "https://example.com/v1/test/1234" | assert | string_literal | pajbot/tests/apiwrappers/test_join_base_and_endpoint.py | test_list_endpoint_with_int_path_segment | 21 | null | |
pajbot/pajbot | from pajbot.modules.bingo import remove_emotes_suffix
def test_remove_emotes_suffix():
assert remove_emotes_suffix("kkona") == | "kkona" | assert | string_literal | pajbot/tests/modules/test_remove_emotes_suffix.py | test_remove_emotes_suffix | 5 | null | |
pajbot/pajbot | def test_filter_banphrase_message() -> None:
from pajbot.web.routes.api.banphrases import filter_message
assert "" == | filter_message("") | assert | func_call | pajbot/tests/test_banphrase_api_filter_message.py | test_filter_banphrase_message | 4 | null | |
pajbot/pajbot | from pajbot.modules.bingo import remove_emotes_suffix
def test_remove_emotes_suffix():
assert remove_emotes_suffix("kkona") == "kkona"
assert remove_emotes_suffix("kkona-emotes") == "kkona"
assert remove_emotes_suffix("kkona-emote") == "kkona"
assert remove_emotes_suffix("kkona_emotes") == "kkona"
... | "" | assert | string_literal | pajbot/tests/modules/test_remove_emotes_suffix.py | test_remove_emotes_suffix | 15 | null | |
pajbot/pajbot | def test_filter_banphrase_message() -> None:
from pajbot.web.routes.api.banphrases import filter_message
assert "" == filter_message("")
assert " forsen" == filter_message(" forsen")
assert "forsen" == | filter_message("forsen\n") | assert | func_call | pajbot/tests/test_banphrase_api_filter_message.py | test_filter_banphrase_message | 6 | null | |
pajbot/pajbot | from pajbot.modules.bingo import join_to_sentence
def test_length_four():
assert join_to_sentence(["asd", "def", "KKona", "xD"]) == | "asd, def, KKona and xD" | assert | string_literal | pajbot/tests/modules/test_join_to_sentence.py | test_length_four | 21 | null | |
pajbot/pajbot | from pajbot.modules.bingo import join_to_sentence
def test_length_one():
assert join_to_sentence(["asd"]) == | "asd" | assert | string_literal | pajbot/tests/modules/test_join_to_sentence.py | test_length_one | 9 | null | |
pajbot/pajbot | import pytest
def randomchoice_cases() -> list[tuple[str, list[str]]]:
return [
('"foo"', ["foo"]),
('"foo""bar"', ["foo", "bar"]),
('"foo" "bar"', ["foo", "bar"]),
('"foo","bar"', ["foo", "bar"]),
('"foo","bar"', ["foo", "bar"]),
('"foo" "bar"', ["foo", "bar"]),
... | expected_matches | assert | variable | pajbot/tests/test_randomchoice.py | test_get_argument_value | 27 | null | |
pajbot/pajbot | def test_filter_banphrase_message() -> None:
from pajbot.web.routes.api.banphrases import filter_message
assert "" == filter_message("")
assert " forsen" == filter_message(" forsen")
assert "forsen" == filter_message("forsen\n")
assert "forsen" == | filter_message("forsen\r") | assert | func_call | pajbot/tests/test_banphrase_api_filter_message.py | test_filter_banphrase_message | 7 | null | |
pajbot/pajbot | from pajbot.modules.bingo import join_to_sentence
def test_length_two():
assert join_to_sentence(["asd", "def"]) == | "asd and def" | assert | string_literal | pajbot/tests/modules/test_join_to_sentence.py | test_length_two | 13 | null | |
pajbot/pajbot | from typing import Optional
from pajbot.models.action import Substitution
import pytest
def get_argument_value_cases() -> list[tuple[Optional[str], Optional[int], str]]:
return [
("foo bar", 1, "foo"),
("foo bar", 0, ""),
("foo bar", None, ""),
(None, None, ""),
(None, 1, ... | expected_substitutions | assert | variable | pajbot/tests/test_action.py | test_argument_substitutions | 40 | null | |
pajbot/pajbot | from pajbot.apiwrappers.base import BaseAPI
def test_list_endpoint_escaping():
assert | "https://example.com/v1/test/%2Fsome%20Data%2F" | assert | string_literal | pajbot/tests/apiwrappers/test_join_base_and_endpoint.py | test_list_endpoint_escaping | 34 | null | |
pajbot/pajbot | from pajbot.modules.trivia import TriviaModule
import pytest
def get_valid_cases() -> list[tuple[tuple[str, str], bool]]:
# (user_answer, correct_answer)
return [
(("foo", "foo"), True),
(("fooba", "fooab"), False),
# Incorrect but close enough
(("the eifel tower", "the eiffel ... | expected | assert | variable | pajbot/tests/modules/test_trivia_confirm_answer.py | test_trivia_confirm_answer | 22 | null | |
pajbot/pajbot | def test_find_unique_urls() -> None:
from pajbot.modules.linkchecker import find_unique_urls
assert find_unique_urls("pajlada.se test http://pajlada.se") == {"http://pajlada.se"}
assert find_unique_urls("pajlada.se pajlada.com foobar.se") == {
"http://pajlada.se",
"http://pajlada.com",
... | set() | assert | func_call | pajbot/tests/test_url_parser.py | test_find_unique_urls | 58 | null | |
pajbot/pajbot | from typing import Optional
from pajbot.models.action import Substitution
import pytest
def get_argument_value_cases() -> list[tuple[Optional[str], Optional[int], str]]:
return [
("foo bar", 1, "foo"),
("foo bar", 0, ""),
("foo bar", None, ""),
(None, None, ""),
(None, 1, ... | expected | assert | variable | pajbot/tests/test_action.py | test_get_argument_value | 26 | null | |
pajbot/pajbot | def test_clean_up() -> None:
from pajbot.utils import clean_up_message
assert "" == "\U000e0000"
assert "" == clean_up_message("")
assert "" == clean_up_message(" ")
assert "" == clean_up_message(" ")
assert ". .timeout pajlada 5" == clean_up_message(".timeout pajlada 5")
assert ". /ti... | clean_up_message(".me") | assert | func_call | pajbot/tests/test_clean_up_message.py | test_clean_up | 14 | null | |
pajbot/pajbot | def test_clean_up() -> None:
from pajbot.utils import clean_up_message
assert "" == "\U000e0000"
assert "" == | clean_up_message("") | assert | func_call | pajbot/tests/test_clean_up_message.py | test_clean_up | 6 | null | |
pajbot/pajbot | from pajbot.apiwrappers.base import BaseAPI
def test_respects_passed_scheme():
assert BaseAPI.fill_in_url_scheme("//example.com", "wss") == | "wss://example.com" | assert | string_literal | pajbot/tests/apiwrappers/test_fill_in_url_scheme.py | test_respects_passed_scheme | 9 | null | |
pajbot/pajbot | from pajbot.modules.bingo import join_to_sentence
def test_length_zero():
assert join_to_sentence([]) == | "" | assert | string_literal | pajbot/tests/modules/test_join_to_sentence.py | test_length_zero | 5 | null | |
pajbot/pajbot | def test_find_unique_urls() -> None:
from pajbot.modules.linkchecker import find_unique_urls
assert find_unique_urls("pajlada.se test http://pajlada.se") == | {"http://pajlada.se"} | assert | collection | pajbot/tests/test_url_parser.py | test_find_unique_urls | 34 | null | |
pajbot/pajbot | from pajbot.modules.bingo import two_word_variations
def test_two_word_variations() -> None:
assert two_word_variations("abc", "def", "KKona") == | { "abc-def": "KKona", "abc_def": "KKona", "abcdef": "KKona", "def-abc": "KKona", "def_abc": "KKona", "defabc": "KKona", } | assert | collection | pajbot/tests/modules/test_two_word_variations.py | test_two_word_variations | 5 | null | |
pajbot/pajbot | from pajbot.utils import parse_number_from_string
import pytest
def test_valid_int_conversions() -> None:
# key = input
# value = expected value
tests = {
"1": 1,
"2": 2,
"3": 3,
"503": 503,
"-503": -503,
"503 ": 503, # Spaces are valid in int() and float()... | type(expected_value) | assert | func_call | pajbot/tests/test_parse_number_from_string.py | test_valid_int_conversions | 23 | null | |
pajbot/pajbot | from pajbot.utils import iterate_split_with_index
import pytest
def test_iterates_correctly() -> None:
# a bcd ef
generator = iterate_split_with_index(["a", "bcd", "ef"])
assert next(generator) == (0, "a")
assert next(generator) == | (2, "bcd") | assert | collection | pajbot/tests/test_iterate_split_with_index.py | test_iterates_correctly | 10 | null | |
pajbot/pajbot | from typing import Optional
import pytest
def get_cases() -> list[tuple[str, tuple[Optional[str], int]]]:
return [
("key", ("key", 1)),
("key 5", ("key", 5)),
("key_key 5", ("key_key", 5)),
("key 5 ", (None, 1)),
("", (None, 1)),
]
@pytest.mark.parametrize("input_str,e... | expected | assert | variable | pajbot/tests/test_kvi.py | test_parse_kvi_arguments | 20 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.