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
PyVRP/PyVRP
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises import pyvrp from pyvrp import CostEvaluator, RandomNumberGenerator from pyvrp.search import ( PerturbationManager, PerturbationParams, compute_neighbours, ) from pyvrp.search._search import SearchSpace, Solution def test_pert...
3)
assert_*
numeric_literal
tests/search/test_PerturbationManager.py
test_perturb_inserts_into_new_routes
169
null
PyVRP/PyVRP
from itertools import pairwise import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp._pyvrp import DurationSegment _INT_MAX = np.iinfo(np.int64).max def test_merging_two_previously_merged_duration_segments(): """ This test evaluates what happens when we merge two previo...
4)
assert_*
numeric_literal
tests/test_DurationSegment.py
test_merging_two_previously_merged_duration_segments
73
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import PiecewiseLinearFunction def test_call(): """ Tests calling the piecewise linear function on various segments. """ fn = PiecewiseLinearFunction([5, 10, 20], [(1, 2), (11, 3), (26, 4)]) # 1st segment, defined for value...
11 + 3 * 5)
assert_*
complex_expr
tests/test_PiecewiseLinearFunction.py
test_call
18
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp import ( Client, CostEvaluator, Depot, ProblemData, RandomNumberGenerator, Solution, VehicleType, ) from pyvrp import Route as SolRoute from pyvrp.search import ( Exchange10, Exchange11, ...
[5])
assert_*
collection
tests/search/test_Exchange.py
test_within_route_simultaneous_pickup_and_delivery
412
null
PyVRP/PyVRP
import pickle import numpy as np import pytest from numpy.random import default_rng from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import Client, ClientGroup, Depot, ProblemData, VehicleType _INT_MAX = np.iinfo(np.int64).max _MAX_SIZE = np.iinfo(np.uint64).max def test_depot_initialises_d...
3)
assert_*
numeric_literal
tests/test_ProblemData.py
test_depot_initialises_data_correctly
182
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_allclose, assert_equal from pytest import mark from pyvrp import RandomNumberGenerator def test_bounds(): """ Tests that the minimum and maximum integer value the RNG can produce corresponds to the underlying type's maximum range. """ a...
0)
assert_*
numeric_literal
tests/test_RandomNumberGenerator.py
test_bounds
13
null
PyVRP/PyVRP
import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import RandomNumberGenerator from pyvrp.search import NeighbourhoodParams, compute_neighbours from pyvrp.search._search import SearchSpace from tests.helpers import make_search_route @pytest.mark.parametrize( ( "weight...
neighbours)
assert_*
variable
tests/search/test_SearchSpace.py
test_set_get_neighbours
85
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp import Client, CostEvaluator, Depot, ProblemData, VehicleType from pyvrp.search import RelocateWithDepot from tests.helpers import make_search_route def test_can_insert_reload_before_end_depot(): """ Tests that Relocat...
"2 3")
assert_*
string_literal
tests/search/test_RelocateWithDepot.py
test_can_insert_reload_before_end_depot
306
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import PiecewiseLinearFunction def test_call(): """ Tests calling the piecewise linear function on various segments. """ fn = PiecewiseLinearFunction([5, 10, 20], [(1, 2), (11, 3), (26, 4)]) # 1st segment, defined for value...
26 + 4 * 10)
assert_*
complex_expr
tests/test_PiecewiseLinearFunction.py
test_call
22
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp import ( Client, CostEvaluator, Depot, ProblemData, RandomNumberGenerator, Solution, VehicleType, ) from pyvrp import Route as SolRoute from pyvrp.search import ( Exchange10, Exchange11, ...
2)
assert_*
numeric_literal
tests/search/test_Exchange.py
test_relocate_after_depot_should_work
219
null
PyVRP/PyVRP
import pickle from numpy.testing import assert_, assert_equal, assert_raises from pytest import mark from pyvrp._pyvrp import DynamicBitset def test_pickle(): """ Tests that DynamicBitset can be pickled and unpickled correctly. """ bitset = DynamicBitset(128) bitset[0] = True bitset[64] = Tru...
unpickled)
assert_*
variable
tests/test_DynamicBitset.py
test_pickle
238
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pytest import mark import pyvrp from pyvrp import ( Client, CostEvaluator, Depot, ProblemData, RandomNumberGenerator, VehicleType, ) from pyvrp import Route as SolRoute from pyvrp.search import LocalSearch, SwapTails from p...
0)
assert_*
numeric_literal
tests/search/test_SwapTails.py
test_move_with_different_profiles
202
null
PyVRP/PyVRP
import math import pickle import pytest from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises from pyvrp import CostEvaluator, RandomNumberGenerator, Solution from pyvrp.Result import Result from pyvrp.Statistics import Statistics @pytest.mark.parametrize("num_iterations", [0, 1, 10]) def t...
before_pickle.stats)
assert_*
complex_expr
tests/test_Result.py
test_result_can_be_pickled
128
null
PyVRP/PyVRP
import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import Route, Trip def test_raises_invalid_clients(ok_small): """ Tests that the constructor raises when given a visits list that contains invalid clients. """ assert_equal(ok_small.num_depots, 1) assert_e...
4)
assert_*
numeric_literal
tests/test_Trip.py
test_raises_invalid_clients
27
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_raises from pytest import mark from pyvrp.stop import NoImprovement @mark.parametrize("max_iterations", [-10, -100, -1000]) def test_raise_negative_parameters(max_iterations: int): """ max_iterations cannot be negative. """ with assert_raises(
ValueError)
assert_*
variable
tests/stop/test_NoImprovement.py
test_raise_negative_parameters
12
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp import Client, CostEvaluator, Depot, ProblemData, VehicleType from pyvrp.search import RelocateWithDepot from tests.helpers import make_search_route def test_bug_release_times(mtvrptw_release_times): """ This test exer...
"6")
assert_*
string_literal
tests/search/test_RelocateWithDepot.py
test_bug_release_times
231
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import ( CostEvaluator, RandomNumberGenerator, Result, Solution, Statistics, ) from pyvrp.ProgressPrinter import ProgressPrinter def test_raises_negative_display_interval(): """ Tests that ProgressPrinter raises when...
ValueError)
assert_*
variable
tests/test_ProgressPrinter.py
test_raises_negative_display_interval
18
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pyvrp import ( Client, ClientGroup, CostEvaluator, Depot, ProblemData, VehicleType, ) from pyvrp.search import InsertOptional from pyvrp.search._search import Node, Solution from tests.helpers import make_search_route def ...
(-1, True))
assert_*
collection
tests/search/test_InsertOptional.py
test_group_skip_duplicates
135
null
PyVRP/PyVRP
from itertools import pairwise import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp._pyvrp import DurationSegment _INT_MAX = np.iinfo(np.int64).max def test_merging_two_previously_merged_duration_segments(): """ This test evaluates what happens when we merge two previo...
1)
assert_*
numeric_literal
tests/test_DurationSegment.py
test_merging_two_previously_merged_duration_segments
56
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp import Client, CostEvaluator, Depot, ProblemData, VehicleType from pyvrp.search import RelocateWithDepot from tests.helpers import make_search_route def test_inserts_depot_single_route(ok_small_multiple_trips): """ Tes...
2)
assert_*
numeric_literal
tests/search/test_RelocateWithDepot.py
test_inserts_depot_single_route
18
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises import pyvrp from pyvrp import CostEvaluator, RandomNumberGenerator from pyvrp.search import ( PerturbationManager, PerturbationParams, compute_neighbours, ) from pyvrp.search._search import SearchSpace, Solution def test_rais...
ValueError)
assert_*
variable
tests/search/test_PerturbationManager.py
test_raises_max_smaller_than_min
18
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pyvrp import ( Client, ClientGroup, CostEvaluator, Depot, ProblemData, VehicleType, ) from pyvrp.search import RemoveOptional from tests.helpers import make_search_route def test_empty_route_delta_cost_bug(): """ T...
(-4, True))
assert_*
collection
tests/search/test_RemoveOptional.py
test_empty_route_delta_cost_bug
154
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pyvrp import ( Client, ClientGroup, CostEvaluator, Depot, ProblemData, VehicleType, ) from pyvrp.search import InsertOptional from pyvrp.search._search import Node, Solution from tests.helpers import make_search_route def ...
(7, False))
assert_*
collection
tests/search/test_InsertOptional.py
test_insert_in_empty_routes_considers_fixed_vehicle_cost
170
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp import ( Client, ClientGroup, CostEvaluator, Depot, ProblemData, RandomNumberGenerator, Route, Solution, Trip, VehicleType, ) from pyvrp.search import ( Exchange10, Exchange11, ...
2)
assert_*
numeric_literal
tests/search/test_LocalSearch.py
test_local_search_inserts_reload_depots
373
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import PiecewiseLinearFunction def test_breakpoints_and_segments_properties(): """ Tests getting the breakpoints and segments. """ fn = PiecewiseLinearFunction([0, 5], [(1, 2), (11, 3)]) assert_equal(fn.breakpoints,
[0, 5])
assert_*
collection
tests/test_PiecewiseLinearFunction.py
test_breakpoints_and_segments_properties
70
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp import ( Client, CostEvaluator, Depot, ProblemData, RandomNumberGenerator, Solution, VehicleType, ) from pyvrp import Route as SolRoute from pyvrp.search import ( Exchange10, Exchange11, ...
3)
assert_*
numeric_literal
tests/search/test_Exchange.py
test_relocate_after_depot_should_work
212
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_allclose, assert_equal from pytest import mark from pyvrp import RandomNumberGenerator def test_randint(): """ The ``randint(high)`` function returns a random integer between ``[0, high]``. Internally, this relies on ``__call__`` (see previous t...
2386648076 % 100)
assert_*
complex_expr
tests/test_RandomNumberGenerator.py
test_randint
40
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal, assert_raises import pyvrp from pyvrp import Client, Depot, ProblemData, VehicleType from pyvrp.search._search import Node, Route from tests.helpers import make_search_route _INT_MAX = np.iinfo(np.int64).max def test_insert_and_remove_...
1)
assert_*
numeric_literal
tests/search/test_Route.py
test_insert_and_remove_update_node_idx_and_route_properties
66
null
PyVRP/PyVRP
from math import sqrt import numpy as np import pytest from numpy.testing import ( assert_, assert_allclose, assert_equal, assert_raises, ) from pyvrp import CostEvaluator from pyvrp.constants import MAX_VALUE from pyvrp.exceptions import ScalingWarning from tests.helpers import read, read_solution d...
3)
assert_*
numeric_literal
tests/test_read.py
test_reading_OkSmall_instance
60
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_equal from pyvrp import CostEvaluator from pyvrp import Solution as PyVRPSolution from pyvrp.search import ReplaceGroup from pyvrp.search._search import Node, Solution def test_replace(ok_small_mutually_exclusive_groups): """ Tests that ReplaceGroup replace clients wi...
"1 4")
assert_*
string_literal
tests/search/test_ReplaceGroup.py
test_replace
18
null
PyVRP/PyVRP
import pickle import numpy as np import pytest from numpy.random import default_rng from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import Client, ClientGroup, Depot, ProblemData, VehicleType _INT_MAX = np.iinfo(np.int64).max _MAX_SIZE = np.iinfo(np.uint64).max def test_depot_initialises_d...
7)
assert_*
numeric_literal
tests/test_ProblemData.py
test_depot_initialises_data_correctly
181
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pyvrp import ( Client, ClientGroup, CostEvaluator, Depot, ProblemData, VehicleType, ) from pyvrp.search import RemoveOptional from tests.helpers import make_search_route def test_does_not_remove_required_clients(): """...
(-10, True))
assert_*
collection
tests/search/test_RemoveOptional.py
test_does_not_remove_required_clients
43
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_equal from pyvrp.RingBuffer import RingBuffer def test_ring_buffer(): """ Tests that the ring buffer correctly tracks recently inserted values, up to a fixed size, and can be cleared to reset its state. """ buffer = RingBuffer(maxlen=2) assert_equal(bu...
1)
assert_*
numeric_literal
tests/test_RingBuffer.py
test_ring_buffer
22
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pytest import mark import pyvrp from pyvrp import ( Client, CostEvaluator, Depot, ProblemData, RandomNumberGenerator, VehicleType, ) from pyvrp import Route as SolRoute from pyvrp.search import LocalSearch, SwapTails from p...
(10, False))
assert_*
collection
tests/search/test_SwapTails.py
test_move_involving_empty_routes
129
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp import Client, CostEvaluator, Depot, ProblemData, VehicleType from pyvrp.search import RelocateWithDepot from tests.helpers import make_search_route def test_inserts_depot_single_route(ok_small_multiple_trips): """ Tes...
[8])
assert_*
collection
tests/search/test_RelocateWithDepot.py
test_inserts_depot_single_route
20
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pytest import mark import pyvrp from pyvrp import ( Client, CostEvaluator, Depot, ProblemData, RandomNumberGenerator, VehicleType, ) from pyvrp import Route as SolRoute from pyvrp.search import LocalSearch, SwapTails from p...
(-16, True))
assert_*
collection
tests/search/test_SwapTails.py
test_move_involving_multiple_depots
178
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_allclose, assert_equal from pyvrp.IteratedLocalSearch import IteratedLocalSearchParams from pyvrp.PenaltyManager import PenaltyParams from pyvrp.search import ( OPERATORS, Exchange10, NeighbourhoodParams, PerturbationParams, SwapTails, ) ...
res2.best)
assert_*
complex_expr
tests/test_solve.py
test_solve_same_seed
69
null
PyVRP/PyVRP
import numpy as np from matplotlib.testing.decorators import image_comparison as img_comp from numpy.testing import assert_equal, assert_raises from pyvrp import ( CostEvaluator, Depot, ProblemData, Result, Route, Solution, Statistics, Trip, VehicleType, plotting, ) from tests.h...
0)
assert_*
numeric_literal
tests/plotting/test_plotting.py
test_plot_demands_raises_for_out_of_bounds_load_dimension
147
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp._pyvrp import LoadSegment _INT_MAX = np.iinfo(np.int64).max @pytest.mark.parametrize( ("delivery", "pickup", "load"), [(1, 2, 3), (0, 0, 0), (_INT_MAX, _INT_MAX, _INT_MAX)], ) def test_attribute_getters(delivery: int,...
delivery)
assert_*
variable
tests/test_LoadSegment.py
test_attribute_getters
19
null
PyVRP/PyVRP
import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import Route, Trip @pytest.mark.parametrize("visits", [[1, 2, 3], [4, 3], [4], [1, 2, 3, 4]]) def test_single_route_and_trip_same_statistics(ok_small, visits: list[int]): """ Tests that a single-trip route and just a trip ...
len(route))
assert_*
func_call
tests/test_Trip.py
test_single_route_and_trip_same_statistics
72
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import ( Client, ClientGroup, Depot, Model, PenaltyParams, Profile, SolveParams, VehicleType, ) from pyvrp.constants import MAX_VALUE from pyvrp.exceptions import ScalingWarning fr...
8)
assert_*
numeric_literal
tests/test_Model.py
test_model_solves_line_instance_with_multiple_depots
589
null
PyVRP/PyVRP
import pickle from itertools import pairwise import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import ( Client, Depot, ProblemData, RandomNumberGenerator, Route, Solution, Trip, VehicleType, ) from tests.helpers import read def test_bug_start_time...
5)
assert_*
numeric_literal
tests/test_Route.py
test_bug_start_time_before_release_time
403
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp._pyvrp import LoadSegment _INT_MAX = np.iinfo(np.int64).max @pytest.mark.parametrize( ("delivery", "pickup", "load"), [(1, 2, 3), (0, 0, 0), (_INT_MAX, _INT_MAX, _INT_MAX)], ) def test_attribute_getters(delivery: int,...
load)
assert_*
variable
tests/test_LoadSegment.py
test_attribute_getters
21
null
PyVRP/PyVRP
import pickle from copy import copy, deepcopy import numpy as np import pytest from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises from pyvrp import ( Client, ClientGroup, Depot, ProblemData, RandomNumberGenerator, Route, Solution, Trip, VehicleType, ) f...
4)
assert_*
numeric_literal
tests/test_Solution.py
test_random_constructor_uses_all_routes
92
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pyvrp import ( Client, ClientGroup, CostEvaluator, Depot, ProblemData, VehicleType, ) from pyvrp.search import InsertOptional from pyvrp.search._search import Node, Solution from tests.helpers import make_search_route def ...
(0, False))
assert_*
collection
tests/search/test_InsertOptional.py
test_skips_assigned_or_missing
52
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_allclose, assert_equal from pyvrp.IteratedLocalSearch import IteratedLocalSearchParams from pyvrp.PenaltyManager import PenaltyParams from pyvrp.search import ( OPERATORS, Exchange10, NeighbourhoodParams, PerturbationParams, SwapTails, ) ...
res2.stats.data)
assert_*
complex_expr
tests/test_solve.py
test_solve_same_seed
70
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_raises from pytest import mark from pyvrp.stop import MaxRuntime from tests.helpers import sleep @mark.parametrize("max_runtime", [-0.001, -1, -10.1]) def test_raise_negative_parameters(max_runtime: float): """ Maximum runtime may not be negative. """ with as...
ValueError)
assert_*
variable
tests/stop/test_MaxRuntime.py
test_raise_negative_parameters
13
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import ( Client, ClientGroup, Depot, Model, PenaltyParams, Profile, SolveParams, VehicleType, ) from pyvrp.constants import MAX_VALUE from pyvrp.exceptions import ScalingWarning fr...
7)
assert_*
numeric_literal
tests/test_Model.py
test_add_depot_attributes
136
null
PyVRP/PyVRP
import math import pickle import pytest from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises from pyvrp import CostEvaluator, RandomNumberGenerator, Solution from pyvrp.Result import Result from pyvrp.Statistics import Statistics @pytest.mark.parametrize( ("routes", "num_iterations", "...
runtime)
assert_*
variable
tests/test_Result.py
test_fields_are_correctly_set
26
null
PyVRP/PyVRP
__doc__ = """ The tests in this file check that Python objects convertible to integers are handled appropriately on the C++ side - this includes checking for potential overflows and meaningful responses in that case. """ import numpy as np import pytest from numpy.testing import assert_equal, assert_raises from pyvrp...
expected)
assert_*
variable
tests/test_type_conversions.py
test_measure_convertible_to_int
33
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import minimise_fleet from pyvrp.stop import MaxIterations from tests.helpers import read def test_X_instance(): """ Tests that the fleet minimisation procedure attains the lower bound on this particular X instance. """ data...
13)
assert_*
numeric_literal
tests/test_minimise_fleet.py
test_X_instance
76
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_allclose, assert_equal from pyvrp.IteratedLocalSearch import IteratedLocalSearchParams from pyvrp.PenaltyManager import PenaltyParams from pyvrp.search import ( OPERATORS, Exchange10, NeighbourhoodParams, PerturbationParams, SwapTails, ) ...
SolveParams())
assert_*
func_call
tests/test_solve.py
test_solve_params_from_file_defaults
58
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import PiecewiseLinearFunction def test_zero(): """ Tests the piecewise linear function with zero slope and/or intercept. """ fn = PiecewiseLinearFunction([0], [(0, 7)]) # zero intercept assert_equal(fn(-1), -7) assert_...
7)
assert_*
numeric_literal
tests/test_PiecewiseLinearFunction.py
test_zero
34
null
PyVRP/PyVRP
import pickle from copy import copy, deepcopy import numpy as np import pytest from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises from pyvrp import ( Client, ClientGroup, Depot, ProblemData, RandomNumberGenerator, Route, Solution, Trip, VehicleType, ) f...
3)
assert_*
numeric_literal
tests/test_Solution.py
test_route_constructor_raises_too_many_vehicles
146
null
PyVRP/PyVRP
from math import sqrt import numpy as np import pytest from numpy.testing import ( assert_, assert_allclose, assert_equal, assert_raises, ) from pyvrp import CostEvaluator from pyvrp.constants import MAX_VALUE from pyvrp.exceptions import ScalingWarning from tests.helpers import read, read_solution d...
1)
assert_*
numeric_literal
tests/test_read.py
test_reading_OkSmall_instance
61
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pytest import mark import pyvrp from pyvrp import ( Client, CostEvaluator, Depot, ProblemData, RandomNumberGenerator, VehicleType, ) from pyvrp import Route as SolRoute from pyvrp.search import LocalSearch, SwapTails from p...
1)
assert_*
numeric_literal
tests/search/test_SwapTails.py
test_move_with_different_profiles
207
null
PyVRP/PyVRP
import pytest from numpy.testing import assert_, assert_equal, assert_raises from pytest import mark from pyvrp import ( IteratedLocalSearch, IteratedLocalSearchCallbacks, IteratedLocalSearchParams, PenaltyManager, RandomNumberGenerator, Result, Solution, ) from pyvrp.search import ( Ex...
res)
assert_*
variable
tests/test_IteratedLocalSearch.py
test_callback_on_start_and_end
304
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import PiecewiseLinearFunction def test_call(): """ Tests calling the piecewise linear function on various segments. """ fn = PiecewiseLinearFunction([5, 10, 20], [(1, 2), (11, 3), (26, 4)]) # 1st segment, defined for value...
1 + 2 * 0)
assert_*
complex_expr
tests/test_PiecewiseLinearFunction.py
test_call
14
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_allclose, assert_equal from pytest import mark from pyvrp import RandomNumberGenerator def test_bounds(): """ Tests that the minimum and maximum integer value the RNG can produce corresponds to the underlying type's maximum range. """ as...
np.iinfo(np.uint32).max)
assert_*
func_call
tests/test_RandomNumberGenerator.py
test_bounds
14
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_equal from pyvrp.RingBuffer import RingBuffer def test_ring_buffer(): """ Tests that the ring buffer correctly tracks recently inserted values, up to a fixed size, and can be cleared to reset its state. """ buffer = RingBuffer(maxlen=2) assert_equal(b...
2)
assert_*
numeric_literal
tests/test_RingBuffer.py
test_ring_buffer
12
null
PyVRP/PyVRP
import pytest from numpy.testing import assert_, assert_equal from pyvrp import CostEvaluator, Solution, Statistics def test_more_eq(ok_small): """ Tests the equality operator for the same search trajectory. """ sol = Solution(ok_small, [[1, 2], [3, 4]]) cost_eval = CostEvaluator([20], 6, 6) ...
stats2)
assert_*
variable
tests/test_Statistics.py
test_more_eq
105
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pytest import mark import pyvrp from pyvrp import ( Client, CostEvaluator, Depot, ProblemData, RandomNumberGenerator, VehicleType, ) from pyvrp import Route as SolRoute from pyvrp.search import LocalSearch, SwapTails from p...
(90, False))
assert_*
collection
tests/search/test_SwapTails.py
test_move_involving_empty_routes
111
null
PyVRP/PyVRP
import pickle from numpy.testing import assert_, assert_equal, assert_raises from pytest import mark from pyvrp._pyvrp import DynamicBitset def test_assert_equal(): """ This test exercises the issue identified in #1038, when assert_equal would hang when comparing two bitsets. """ bitset1 = Dynami...
bitset2)
assert_*
variable
tests/test_DynamicBitset.py
test_assert_equal
58
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_allclose, assert_equal from pyvrp.IteratedLocalSearch import IteratedLocalSearchParams from pyvrp.PenaltyManager import PenaltyParams from pyvrp.search import ( OPERATORS, Exchange10, NeighbourhoodParams, PerturbationParams, SwapTails, ) ...
penalty)
assert_*
variable
tests/test_solve.py
test_solve_params_from_file
45
null
PyVRP/PyVRP
import pytest from numpy.testing import assert_, assert_equal, assert_raises from pytest import mark from pyvrp import ( IteratedLocalSearch, IteratedLocalSearchCallbacks, IteratedLocalSearchParams, PenaltyManager, RandomNumberGenerator, Result, Solution, ) from pyvrp.search import ( Ex...
0)
assert_*
numeric_literal
tests/test_IteratedLocalSearch.py
test_exhaustive_search_on_new_best_solution
261
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_raises from pytest import mark from pyvrp.stop import ( MaxIterations, MaxRuntime, MultipleCriteria, ) from tests.helpers import sleep def test_raises_if_empty(): """ Tests that passing no criteria results in an error. """ with assert_raises(
ValueError)
assert_*
variable
tests/stop/test_MultipleCriteria.py
test_raises_if_empty
16
null
PyVRP/PyVRP
import math import pickle import pytest from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises from pyvrp import CostEvaluator, RandomNumberGenerator, Solution from pyvrp.Result import Result from pyvrp.Statistics import Statistics @pytest.mark.parametrize( ("routes", "num_iterations", "...
sol.is_feasible())
assert_*
func_call
tests/test_Result.py
test_fields_are_correctly_set
24
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pyvrp import Client, CostEvaluator, Depot, ProblemData, VehicleType from pyvrp.search import ReplaceOptional from pyvrp.search._search import Node from tests.helpers import make_search_route def test_skips_replacing_required_client(): """ ...
(0, False))
assert_*
collection
tests/search/test_ReplaceOptional.py
test_skips_replacing_required_client
62
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pyvrp import ( Client, ClientGroup, CostEvaluator, Depot, ProblemData, VehicleType, ) from pyvrp.search import RemoveOptional from tests.helpers import make_search_route def test_does_not_remove_required_clients(): """...
"1")
assert_*
string_literal
tests/search/test_RemoveOptional.py
test_does_not_remove_required_clients
47
null
PyVRP/PyVRP
import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import Route, Trip @pytest.mark.parametrize(("start_idx", "end_idx"), [(1, 0), (0, 1)]) def test_trip_raises_for_invalid_depot_arguments(ok_small, start_idx, end_idx): """ The constructor should raise when the start or end...
1)
assert_*
numeric_literal
tests/test_Trip.py
test_trip_raises_for_invalid_depot_arguments
13
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp._pyvrp import LoadSegment _INT_MAX = np.iinfo(np.int64).max @pytest.mark.parametrize( ("first", "second", "exp_delivery", "exp_pickup", "exp_load"), [ ( LoadSegment(delivery=5, pickup=8, load=8), ...
0)
assert_*
numeric_literal
tests/test_LoadSegment.py
test_merge_two
59
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pyvrp import ( Client, ClientGroup, CostEvaluator, Depot, ProblemData, VehicleType, ) from pyvrp.search import InsertOptional from pyvrp.search._search import Node, Solution from tests.helpers import make_search_route def ...
"1 2 3")
assert_*
string_literal
tests/search/test_InsertOptional.py
test_inserts_when_makes_sense
23
null
PyVRP/PyVRP
from numpy.testing import assert_, assert_equal from pyvrp import CostEvaluator from pyvrp import Solution as PyVRPSolution from pyvrp.search import ReplaceGroup from pyvrp.search._search import Node, Solution def test_replace(ok_small_mutually_exclusive_groups): """ Tests that ReplaceGroup replace clients wi...
"2 4")
assert_*
string_literal
tests/search/test_ReplaceGroup.py
test_replace
31
null
PyVRP/PyVRP
import pytest from numpy.testing import assert_, assert_equal, assert_raises from pytest import mark from pyvrp import ( IteratedLocalSearch, IteratedLocalSearchCallbacks, IteratedLocalSearchParams, PenaltyManager, RandomNumberGenerator, Result, Solution, ) from pyvrp.search import ( Ex...
bks)
assert_*
variable
tests/test_IteratedLocalSearch.py
test_best_initial_solution
104
null
PyVRP/PyVRP
import pickle from numpy.testing import assert_, assert_equal, assert_raises from pytest import mark from pyvrp._pyvrp import DynamicBitset def test_init_all_zero(): """ The bitset starts out empty, that is, is initialised to all zeros. """ bitset = DynamicBitset(64) assert_(all(not bitset[idx] f...
0)
assert_*
numeric_literal
tests/test_DynamicBitset.py
test_init_all_zero
27
null
PyVRP/PyVRP
import pickle from copy import copy, deepcopy import numpy as np import pytest from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises from pyvrp import ( Client, ClientGroup, Depot, ProblemData, RandomNumberGenerator, Route, Solution, Trip, VehicleType, ) f...
0)
assert_*
numeric_literal
tests/test_Solution.py
test_route_constructor_with_different_vehicle_types
55
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_allclose, assert_equal from pyvrp.IteratedLocalSearch import IteratedLocalSearchParams from pyvrp.PenaltyManager import PenaltyParams from pyvrp.search import ( OPERATORS, Exchange10, NeighbourhoodParams, PerturbationParams, SwapTails, ) ...
ils)
assert_*
variable
tests/test_solve.py
test_solve_params_from_file
44
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import ( Client, ClientGroup, Depot, Model, PenaltyParams, Profile, SolveParams, VehicleType, ) from pyvrp.constants import MAX_VALUE from pyvrp.exceptions import ScalingWarning fr...
0)
assert_*
numeric_literal
tests/test_Model.py
test_add_depot_attributes
134
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pyvrp import ( Client, ClientGroup, CostEvaluator, Depot, ProblemData, VehicleType, ) from pyvrp.search import RemoveOptional from tests.helpers import make_search_route def test_does_not_remove_required_clients(): """...
(0, False))
assert_*
collection
tests/search/test_RemoveOptional.py
test_does_not_remove_required_clients
42
null
PyVRP/PyVRP
import math import pickle import pytest from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises from pyvrp import CostEvaluator, RandomNumberGenerator, Solution from pyvrp.Result import Result from pyvrp.Statistics import Statistics @pytest.mark.parametrize("num_iterations", [0, 1, 10]) def t...
before_pickle.best)
assert_*
complex_expr
tests/test_Result.py
test_result_can_be_pickled
127
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_allclose, assert_equal from pyvrp.IteratedLocalSearch import IteratedLocalSearchParams from pyvrp.PenaltyManager import PenaltyParams from pyvrp.search import ( OPERATORS, Exchange10, NeighbourhoodParams, PerturbationParams, SwapTails, ) ...
PenaltyParams())
assert_*
func_call
tests/test_solve.py
test_default_values
25
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import ( Client, ClientGroup, Depot, Model, PenaltyParams, Profile, SolveParams, VehicleType, ) from pyvrp.constants import MAX_VALUE from pyvrp.exceptions import ScalingWarning fr...
2)
assert_*
numeric_literal
tests/test_Model.py
test_add_client_attributes
104
null
PyVRP/PyVRP
import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import Route, Trip def test_trip_defaults_to_vehicle_start_end_depots(ok_small_multi_depot): """ Tests that the constructor defaults to using the vehicle's start and end depots if no explicit trip start and end depots ...
0)
assert_*
numeric_literal
tests/test_Trip.py
test_trip_defaults_to_vehicle_start_end_depots
42
null
PyVRP/PyVRP
import pickle from itertools import pairwise import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import ( Client, Depot, ProblemData, RandomNumberGenerator, Route, Solution, Trip, VehicleType, ) from tests.helpers import read def test_statistics_wit...
2)
assert_*
numeric_literal
tests/test_Route.py
test_statistics_with_small_multi_trip_example
611
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal, assert_raises from pytest import mark from pyvrp import VehicleType from pyvrp.search import NeighbourhoodParams, compute_neighbours def test_neighbours_are_sorted_by_proximity(small_cvrp): """ Tests that the neighbourhood lists sort by their...
neighbours[client])
assert_*
complex_expr
tests/search/test_neighbourhood.py
test_neighbours_are_sorted_by_proximity
129
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_allclose, assert_equal from pyvrp.IteratedLocalSearch import IteratedLocalSearchParams from pyvrp.PenaltyManager import PenaltyParams from pyvrp.search import ( OPERATORS, Exchange10, NeighbourhoodParams, PerturbationParams, SwapTails, ) ...
PerturbationParams())
assert_*
func_call
tests/test_solve.py
test_default_values
29
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp._pyvrp import LoadSegment _INT_MAX = np.iinfo(np.int64).max @pytest.mark.parametrize( ("capacity", "exp_excess"), [(10, 20), (5, 20), (0, 25)], ) def test_finalise(capacity: int, exp_excess: int): """ Tests th...
exp_excess)
assert_*
variable
tests/test_LoadSegment.py
test_finalise
93
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import ( Client, ClientGroup, Depot, Model, PenaltyParams, Profile, SolveParams, VehicleType, ) from pyvrp.constants import MAX_VALUE from pyvrp.exceptions import ScalingWarning fr...
4)
assert_*
numeric_literal
tests/test_Model.py
test_add_client_attributes
107
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pyvrp import ( Client, ClientGroup, CostEvaluator, Depot, ProblemData, VehicleType, ) from pyvrp.search import RemoveOptional from tests.helpers import make_search_route def test_fixed_vehicle_cost(): """ Tests tha...
(-7, True))
assert_*
collection
tests/search/test_RemoveOptional.py
test_fixed_vehicle_cost
101
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import ( Client, CostEvaluator, Depot, ProblemData, Route, Solution, VehicleType, ) @pytest.mark.parametrize("load_penalty", (2, 4)) def test_load_penalty(load_penalty: float): ""...
0)
assert_*
numeric_literal
tests/test_CostEvaluator.py
test_load_penalty
46
null
PyVRP/PyVRP
import sys import pytest from numpy.testing import ( assert_, assert_allclose, assert_equal, assert_raises, ) from pyvrp import PenaltyManager, PenaltyParams, Solution, VehicleType from pyvrp.exceptions import PenaltyBoundWarning def test_load_penalty_update_increase(ok_small): """ Tests that...
1)
assert_*
numeric_literal
tests/test_PenaltyManager.py
test_load_penalty_update_increase
107
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pyvrp import ( Client, ClientGroup, CostEvaluator, Depot, ProblemData, VehicleType, ) from pyvrp.search import InsertOptional from pyvrp.search._search import Node, Solution from tests.helpers import make_search_route def ...
(13, False))
assert_*
collection
tests/search/test_InsertOptional.py
test_insert_in_empty_routes_considers_fixed_vehicle_cost
175
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal, assert_raises from pytest import mark from pyvrp import VehicleType from pyvrp.search import NeighbourhoodParams, compute_neighbours def test_neighbourhood_params_raises_for_empty_neighbourhoods(): """ Test that ``NeighbourhoodParams`` raises...
ValueError)
assert_*
variable
tests/search/test_neighbourhood.py
test_neighbourhood_params_raises_for_empty_neighbourhoods
13
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp import ( Client, ClientGroup, CostEvaluator, Depot, ProblemData, RandomNumberGenerator, Route, Solution, Trip, VehicleType, ) from pyvrp.search import ( Exchange10, Exchange11, ...
1)
assert_*
numeric_literal
tests/search/test_LocalSearch.py
test_mutually_exclusive_group_not_in_solution
298
null
PyVRP/PyVRP
import numpy as np from numpy.testing import assert_, assert_equal from pyvrp import ( Client, ClientGroup, CostEvaluator, Depot, ProblemData, VehicleType, ) from pyvrp.search import RemoveOptional from tests.helpers import make_search_route def test_cannot_remove_required_group(): """ ...
(-1, True))
assert_*
collection
tests/search/test_RemoveOptional.py
test_cannot_remove_required_group
186
null
PyVRP/PyVRP
import pickle from copy import copy, deepcopy import numpy as np import pytest from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises from pyvrp import ( Client, ClientGroup, Depot, ProblemData, RandomNumberGenerator, Route, Solution, Trip, VehicleType, ) f...
2)
assert_*
numeric_literal
tests/test_Solution.py
test_route_constructor_with_different_vehicle_types
52
null
PyVRP/PyVRP
import pickle from itertools import pairwise import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import ( Client, Depot, ProblemData, RandomNumberGenerator, Route, Solution, Trip, VehicleType, ) from tests.helpers import read def test_route_depot_ac...
0)
assert_*
numeric_literal
tests/test_Route.py
test_route_depot_accessors
30
null
PyVRP/PyVRP
import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp import Client, CostEvaluator, Depot, ProblemData, VehicleType from pyvrp.search import RelocateWithDepot from tests.helpers import make_search_route def test_inserts_depot_single_route(ok_small_multiple_trips): """ Tes...
3)
assert_*
numeric_literal
tests/search/test_RelocateWithDepot.py
test_inserts_depot_single_route
35
null
PyVRP/PyVRP
from itertools import pairwise import numpy as np import pytest from numpy.testing import assert_, assert_equal from pyvrp._pyvrp import DurationSegment _INT_MAX = np.iinfo(np.int64).max def test_max_duration_argument(): """ Tests that the ``max_duration`` argument is evaluated correctly, and indeed inc...
5)
assert_*
numeric_literal
tests/test_DurationSegment.py
test_max_duration_argument
99
null
PyVRP/PyVRP
import pytest from numpy.testing import assert_, assert_equal, assert_raises from pyvrp import Route, Trip def test_load(ok_small): """ Tests load calculations for a small instance. """ trip = Trip(ok_small, [1, 2, 3, 4], 0) assert_equal(trip.delivery(),
[18])
assert_*
collection
tests/test_Trip.py
test_load
147
null