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
hungpham2511/toppra
import toppra.solverwrapper.cy_seidel_solverwrapper as seidel import numpy as np from numpy import array import pytest import cvxpy as cvx testdata_correct = [ ([1, 2, 3.0], None, None, None, [-1, -1], [1, 1], [-1, 1], 1, 6, [1, 1], [-2, -4]), ([-2, 2, 2.0], None, None, None, [-1, -1], [1, 1], [-1, 1], ...
np.asarray(x.value).flatten())
assert_*
func_call
tests/tests/lpsolvers/seidel/test_lp2d.py
test_random_constraints
110
null
hungpham2511/toppra
import toppra import pytest import numpy as np def accel_constraint(request): dof = 5 np.random.seed(0) alim_ = np.random.rand(5) alim = np.vstack((-alim_, alim_)).T constraint = toppra.constraint.JointAccelerationConstraint(alim) np.random.seed(0) path = toppra.SplineInterpolator(np.linsp...
"Perturbation must be non-negative. Input {:}".format([-0.1, 2, .3])
assert
string_literal
tests/tests/constraint/test_robust_can_linear.py
test_negative_perb
57
null
hungpham2511/toppra
import pytest import numpy as np import toppra import toppra.constraint as constraint toppra.setup_logging(level="INFO") @pytest.mark.parametrize("solver_wrapper", ["qpoases", "hotqpoases", "seidel"]) def test_simple_set_operations(basic_constraints, basic_path, solver_wrapper): """Solve some basic problem instan...
None
assert
none_literal
tests/tests/retime/test_retime_basic.py
test_simple_set_operations
34
null
hungpham2511/toppra
import pytest import numpy as np import numpy.testing as npt import toppra as ta import toppra.constraint as constraint from toppra.constants import JACC_MAXU def create_acceleration_pc_fixtures(request): """ Parameterized Acceleration path constraint. Return: ------- data: A tuple. Contains path, s...
pss[i])
assert_*
complex_expr
tests/tests/constraint/test_joint_acceleration.py
test_constraint_params
90
null
hungpham2511/toppra
import pytest import numpy as np import toppra toppra.setup_logging(level="INFO") @pytest.mark.skip(reason="Do not handle zero motion case.") @pytest.mark.parametrize("Ngrid", [101, 1001]) def test_scalar_zero_motion(Ngrid): """The simple zero motion trajectory Note: Paths with very small displacement, like ...
9e-4
assert
numeric_literal
tests/tests/retime/test_zero_motions.py
test_scalar_zero_motion
45
null
hungpham2511/toppra
import toppra import pytest import numpy as np def accel_constraint(request): dof = 5 np.random.seed(0) alim_ = np.random.rand(5) alim = np.vstack((-alim_, alim_)).T constraint = toppra.constraint.JointAccelerationConstraint(alim) np.random.seed(0) path = toppra.SplineInterpolator(np.linsp...
F0.dot(b0[i]))
assert_*
func_call
tests/tests/constraint/test_robust_can_linear.py
test_basic
46
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt import pytest from toppra import SplineInterpolator from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def given_scalar_spline_interpolator(): sswp, wp, ss, path_interval = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2, 0.3, 0.5], [0, 0.5]] pi = Spli...
qs_rave)
assert_*
variable
tests/tests/interpolators/test_spline_interpolator.py
test_compute_rave_trajectory
147
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt import pytest from toppra import SplineInterpolator from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def given_scalar_spline_interpolator(): sswp, wp, ss, path_interval = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2, 0.3, 0.5], [0, 0.5]] pi = Spli...
np.r_[0, 0, 0])
assert_*
complex_expr
tests/tests/interpolators/test_spline_interpolator.py
test_1waypoints
58
null
hungpham2511/toppra
import pytest import numpy as np import toppra import toppra.constraint as constraint def given_basic_path(request): """ Return a generic path. """ if request.param == "spline": np.random.seed(1) path = toppra.SplineInterpolator(np.linspace(0, 1, 5), np.random.randn(5, 7)) elif request....
final_velocity_expt)
assert_*
variable
tests/tests/retime/test_correct_velocity.py
test_nonzero_velocity
56
null
hungpham2511/toppra
import pytest import numpy as np import numpy.testing as npt import toppra as ta import toppra.constraint as constraint from toppra.constants import JACC_MAXU def create_acceleration_pc_fixtures(request): """ Parameterized Acceleration path constraint. Return: ------- data: A tuple. Contains path, s...
constraint.ConstraintType.CanonicalLinear
assert
complex_expr
tests/tests/constraint/test_joint_acceleration.py
test_constraint_type
65
null
hungpham2511/toppra
import pytest import numpy as np import toppra def coefficients_functions(): "Coefficients for the equation: A(q) ddot q + dot q B(q) dot q + C(q) = w" def A(q): return np.array([[np.sin(q[0]), 0], [np.cos(q[1]), q[0] + q[1]]]) def B(q): ret = np.zeros((2, 2, 2)) ...
a[i])
assert_*
complex_expr
tests/tests/constraint/test_second_order.py
test_correctness
70
null
hungpham2511/toppra
import toppra import pytest import numpy as np def accel_constraint(request): dof = 5 np.random.seed(0) alim_ = np.random.rand(5) alim = np.vstack((-alim_, alim_)).T constraint = toppra.constraint.JointAccelerationConstraint(alim) np.random.seed(0) path = toppra.SplineInterpolator(np.linsp...
F0.dot(a0[i]))
assert_*
func_call
tests/tests/constraint/test_robust_can_linear.py
test_basic
45
null
hungpham2511/toppra
import pytest import cvxpy as cvx import numpy as np import numpy.testing as npt import toppra as ta import toppra.constraint as constraint from toppra.constants import TINY, JVEL_MAXSD, SMALL from scipy.interpolate import CubicSpline def create_velocity_pc_fixtures(request): """Parameterized fixture to test Veloc...
err.value
assert
complex_expr
tests/tests/constraint/test_joint_velocity.py
test_negative_bound_given
151
null
hungpham2511/toppra
import toppra import pytest import numpy as np from numpy.testing import assert_allclose def give_a_2dof_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2], np.array([[0, 0], [1, 2.0], [1, 2.0]])) yield f def give_a_simple_scalar_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2]...
(2,)
assert
collection
tests/tests/interpolators/test_simple_path.py
test_path_interpolate_are_correct
59
null
hungpham2511/toppra
import pytest import numpy as np import toppra import toppra.constraint as constraint toppra.setup_logging(level="INFO") @pytest.mark.parametrize("solver_wrapper", ["qpoases", "hotqpoases", "seidel"]) def test_compute_parametrization_and_get_data(basic_constraints, basic_path, solver_wrapper): """Solve some basic...
0
assert
numeric_literal
tests/tests/retime/test_retime_basic.py
test_compute_parametrization_and_get_data
51
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt import pytest from toppra import SplineInterpolator from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def given_scalar_spline_interpolator(): sswp, wp, ss, path_interval = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2, 0.3, 0.5], [0, 0.5]] pi = Spli...
qdds_rave)
assert_*
variable
tests/tests/interpolators/test_spline_interpolator.py
test_compute_rave_trajectory
149
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt from toppra import PolynomialPath def test_scalar(): """Scalar case.""" pi = PolynomialPath([1, 2, 3], s_start=0, s_end=2) # 1 + 2s + 3s^2 assert pi.dof == 1 npt.assert_allclose(pi.eval([0, 0.5, 1]),
[1, 2.75, 6])
assert_*
collection
tests/tests/interpolators/test_poly_interpolator.py
test_scalar
11
null
hungpham2511/toppra
import pytest import numpy as np import toppra import toppra.constraint as constraint toppra.setup_logging(level="INFO") @pytest.mark.parametrize("solver_wrapper", [ "qpoases,hotqpoases", "qpoases,seidel", "hotqpoases,seidel" ]) def test_toppra_linear_compare(basic_constraints, basic_path, solver_wrapper)...
K2[i])
assert_*
complex_expr
tests/tests/retime/test_retime_basic.py
test_toppra_linear_compare
74
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt from toppra import PolynomialPath def test_scalar(): """Scalar case.""" pi = PolynomialPath([1, 2, 3], s_start=0, s_end=2) # 1 + 2s + 3s^2 assert pi.dof == 1 npt.assert_allclose(pi.eval([0, 0.5, 1]), [1, 2.75, 6]) npt.assert_allclose(pi.evald([0, 0.5,...
[6, 6, 6])
assert_*
collection
tests/tests/interpolators/test_poly_interpolator.py
test_scalar
13
null
hungpham2511/toppra
import pytest import toppra.cpp as tac import numpy as np import msgpack pytestmark = pytest.mark.skipif( not tac.bindings_loaded(), reason="c++ bindings not built" ) def path(): c = np.array( [[-0.500000, -0.500000, 1.500000, 0.500000, 0.000000, 3.000000, 0.000000, 0.000000,], [-0.500000, -0...
[0.3125, 1.5625])
assert_*
collection
tests/tests/cpp/test_piecewise_poly_path.py
test_check_piecewise_poly_path
30
null
hungpham2511/toppra
import pytest import numpy as np import numpy.testing as npt import toppra as ta import toppra.constraint as constraint from toppra.constants import JACC_MAXU def create_acceleration_pc_fixtures(request): """ Parameterized Acceleration path constraint. Return: ------- data: A tuple. Contains path, s...
ps[i])
assert_*
complex_expr
tests/tests/constraint/test_joint_acceleration.py
test_constraint_params
89
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt import pytest from toppra import SplineInterpolator from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def given_scalar_spline_interpolator(): sswp, wp, ss, path_interval = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2, 0.3, 0.5], [0, 0.5]] pi = Spli...
qds_rave)
assert_*
variable
tests/tests/interpolators/test_spline_interpolator.py
test_compute_rave_trajectory
148
null
hungpham2511/toppra
import toppra.solverwrapper.cy_seidel_solverwrapper as seidel import numpy as np from numpy import array import pytest import cvxpy as cvx testdata_correct = [ ([1, 2, 3.0], None, None, None, [-1, -1], [1, 1], [-1, 1], 1, 6, [1, 1], [-2, -4]), ([-2, 2, 2.0], None, None, None, [-1, -1], [1, 1], [-1, 1], ...
0
assert
numeric_literal
tests/tests/lpsolvers/seidel/test_lp2d.py
test_random_constraints
112
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt import pytest from toppra import SplineInterpolator from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def given_scalar_spline_interpolator(): sswp, wp, ss, path_interval = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2, 0.3, 0.5], [0, 0.5]] pi = Spli...
np.r_[0, 0])
assert_*
complex_expr
tests/tests/interpolators/test_spline_interpolator.py
test_1waypoints
56
null
hungpham2511/toppra
import toppra import pytest def setup_geometric_path(): yield toppra.SplineInterpolator([0, 1, 2], [(0, 0), (1, 2), (2, 0)]) def test_initialzie(path): gridpoints = [0, 0.5, 1, 1.5, 2] velocities = [1, 2, 2, 1, 0] # xd = [1, 4, 4, 1, 0] # ud = [6.0, 0, -6.0, -2.0] path_new = toppra.Parametriz...
0
assert
numeric_literal
tests/tests/parametrize/test_spline.py
test_initialzie
17
null
hungpham2511/toppra
import toppra import pytest import numpy as np from numpy.testing import assert_allclose def give_a_2dof_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2], np.array([[0, 0], [1, 2.0], [1, 2.0]])) yield f def give_a_simple_scalar_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2]...
np.array(0))
assert_*
func_call
tests/tests/interpolators/test_simple_path.py
test_first_derivative_zero_at_endpoints
37
null
hungpham2511/toppra
import pytest import numpy as np import toppra toppra.setup_logging(level="INFO") @pytest.mark.skip(reason="Do not handle zero motion case.") @pytest.mark.parametrize("Ngrid", [101, 1001]) def test_scalar_zero_motion(Ngrid): """The simple zero motion trajectory Note: Paths with very small displacement, like ...
None
assert
none_literal
tests/tests/retime/test_zero_motions.py
test_scalar_zero_motion
44
null
hungpham2511/toppra
import pytest import cvxpy as cvx import numpy as np import numpy.testing as npt import toppra as ta import toppra.constraint as constraint from toppra.constants import TINY, JVEL_MAXSD, SMALL from scipy.interpolate import CubicSpline def create_velocity_pc_fixtures(request): """Parameterized fixture to test Veloc...
0
assert
numeric_literal
tests/tests/constraint/test_joint_velocity.py
test_jnt_vel_varying_basic
136
null
hungpham2511/toppra
import toppra import pytest import numpy as np from numpy.testing import assert_allclose def give_a_2dof_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2], np.array([[0, 0], [1, 2.0], [1, 2.0]])) yield f def give_a_simple_scalar_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2]...
[1, 2])
assert_*
collection
tests/tests/interpolators/test_simple_path.py
test_path_interpolate_are_correct
62
null
hungpham2511/toppra
import toppra import pytest import numpy as np def accel_constraint(request): dof = 5 np.random.seed(0) alim_ = np.random.rand(5) alim = np.vstack((-alim_, alim_)).T constraint = toppra.constraint.JointAccelerationConstraint(alim) np.random.seed(0) path = toppra.SplineInterpolator(np.linsp...
5
assert
numeric_literal
tests/tests/constraint/test_robust_can_linear.py
test_basic
28
null
hungpham2511/toppra
import pytest import toppra import numpy as np from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def barret_robot(rave_env): rave_env.Reset() rave_env.Load("data/lab1.env.xml") robot = rave_env.GetRobots()[0] yield robot @pytest.mark.skipif(not IMPORT_OPENRAVEPY, reason=IMPORT_OPENR...
(2 * dof, dof)
assert
collection
tests/tests/constraint/test_create_rave_torque.py
test_shape
29
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt import pytest from toppra import SplineInterpolator from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def given_scalar_spline_interpolator(): sswp, wp, ss, path_interval = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2, 0.3, 0.5], [0, 0.5]] pi = Spli...
1
assert
numeric_literal
tests/tests/interpolators/test_spline_interpolator.py
test_scalar
30
null
hungpham2511/toppra
import numpy as np import toppra.cpp import pytest def torque_constraint(robot, scale=1.0): from toppra.constraint import JointTorqueConstraint, DiscretizationType def inv_dyn(q, v, a): return pinocchio.rnea(robot.model, robot.data, q, v, a) jt = JointTorqueConstraint( inv_dyn, n...
1.0
assert
numeric_literal
tests/integration_tests/test_with_pinocchio.py
torque_constraint_cpp
39
null
hungpham2511/toppra
import pytest import numpy as np import toppra import toppra.constraint as constraint toppra.setup_logging(level="INFO") @pytest.mark.parametrize("solver_wrapper", ["qpoases", "hotqpoases", "seidel"]) def test_compute_parametrization_and_get_data(basic_constraints, basic_path, solver_wrapper): """Solve some basic...
toppra.algorithm.ParameterizationReturnCode.Ok
assert
complex_expr
tests/tests/retime/test_retime_basic.py
test_compute_parametrization_and_get_data
49
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt from toppra import PolynomialPath def test_2_dof(): """Polynomial path with 2dof.""" pi = PolynomialPath([[1, 2, 3], [-2, 3, 4, 5]]) # [1 + 2s + 3s^2] # [-2 + 3s + 4s^2 + 5s^3] assert pi.dof == 2 npt.assert_allclose(
[[1, -2], [2.75, 1.125], [6, 10]])
assert_*
collection
tests/tests/interpolators/test_poly_interpolator.py
test_2_dof
23
null
hungpham2511/toppra
import pytest import numpy as np import toppra import toppra.constraint as constraint toppra.setup_logging(level="INFO") def vel_accel_robustaccel(request): "Velocity + Acceleration + Robust Acceleration constraint" dtype_a, dtype_ra = request.param vlims = np.array([[-1, 1], [-1, 2], [-1, 4]], dtype=floa...
None
assert
none_literal
tests/tests/retime/test_retime_wconic_constraints.py
test_toppra_conic
48
null
hungpham2511/toppra
import pytest import numpy as np import numpy.testing as npt import toppra as ta import toppra.constraint as constraint from toppra.constants import JACC_MAXU def create_acceleration_pc_fixtures(request): """ Parameterized Acceleration path constraint. Return: ------- data: A tuple. Contains path, s...
"Wrong dimension: constraint dof ({:d}) not equal to path dof ({:d})".format( path_constraint.get_dof(), 10 )
assert
string_literal
tests/tests/constraint/test_joint_acceleration.py
test_wrong_dimension
101
null
hungpham2511/toppra
import toppra import toppra.interpolator import numpy as np import matplotlib.pyplot as plt import pytest def path(request): start, end = request.param waypoints = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2], [0, 0.5, 0]] ss = np.linspace(start, end, len(waypoints)) path = toppra.interpolator.SplineInte...
path.path_interval[0]
assert
complex_expr
tests/tests/interpolators/test_find_gridpoints.py
test_basic_usage
20
null
hungpham2511/toppra
import pytest import numpy as np import toppra def coefficients_functions(): "Coefficients for the equation: A(q) ddot q + dot q B(q) dot q + C(q) = w" def A(q): return np.array([[np.sin(q[0]), 0], [np.cos(q[1]), q[0] + q[1]]]) def B(q): ret = np.zeros((2, 2, 2)) ...
"Wrong dimension: constraint dof ({:d}) not equal to path dof ({:d})".format( constraint.dof, 10)
assert
string_literal
tests/tests/constraint/test_second_order.py
test_wrong_dimension
46
null
hungpham2511/toppra
import pytest import numpy as np import toppra import toppra.constraint as constraint toppra.setup_logging(level="INFO") @pytest.mark.parametrize("solver_wrapper", [ "qpoases,hotqpoases", "qpoases,seidel", "hotqpoases,seidel" ]) def test_toppra_linear_compare(basic_constraints, basic_path, solver_wrapper)...
sd2[i])
assert_*
complex_expr
tests/tests/retime/test_retime_basic.py
test_toppra_linear_compare
86
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt from toppra import PolynomialPath def test_scalar(): """Scalar case.""" pi = PolynomialPath([1, 2, 3], s_start=0, s_end=2) # 1 + 2s + 3s^2 assert pi.dof == 1 npt.assert_allclose(pi.eval([0, 0.5, 1]), [1, 2.75, 6]) npt.assert_allclose(pi.evald([0, 0.5,...
np.r_[0, 2])
assert_*
complex_expr
tests/tests/interpolators/test_poly_interpolator.py
test_scalar
14
null
hungpham2511/toppra
import numpy as np import toppra.cpp import pytest def torque_constraint(robot, scale=1.0): from toppra.constraint import JointTorqueConstraint, DiscretizationType def inv_dyn(q, v, a): return pinocchio.rnea(robot.model, robot.data, q, v, a) jt = JointTorqueConstraint( inv_dyn, n...
sdcpp)
assert_*
variable
tests/integration_tests/test_with_pinocchio.py
test_evaluate_consistency
179
null
hungpham2511/toppra
import toppra import pytest import numpy as np from numpy.testing import assert_allclose def give_a_2dof_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2], np.array([[0, 0], [1, 2.0], [1, 2.0]])) yield f def give_a_simple_scalar_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2]...
1.0
assert
numeric_literal
tests/tests/interpolators/test_simple_path.py
test_check_scalar_value_same_as_endpoint
22
null
hungpham2511/toppra
import toppra.solverwrapper.cy_seidel_solverwrapper as seidel import numpy as np import pytest testdata = [ (np.array([1.0, 2], dtype=float), np.array([]), np.array([]), -1.0, 1.0, 1, 3, 1, -2), (np.array([1.0, 2], dtype=float), [], [], -1.0, 1.0, 1, 3, 1, -2), (np.array([1.0, 2], dtype=float), None, None,...
optval_expected
assert
variable
tests/tests/lpsolvers/seidel/test_lp1d.py
test_correct
35
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt import pytest from toppra import SplineInterpolator from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def given_scalar_spline_interpolator(): sswp, wp, ss, path_interval = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2, 0.3, 0.5], [0, 0.5]] pi = Spli...
yd)
assert_*
variable
tests/tests/interpolators/test_spline_interpolator.py
test_2waypoints
72
null
hungpham2511/toppra
import toppra.solverwrapper.cy_seidel_solverwrapper as seidel import numpy as np from numpy import array import pytest import cvxpy as cvx testdata_correct = [ ([1, 2, 3.0], None, None, None, [-1, -1], [1, 1], [-1, 1], 1, 6, [1, 1], [-2, -4]), ([-2, 2, 2.0], None, None, None, [-1, -1], [1, 1], [-1, 1], ...
np.asarray(x.value).flatten()[1])
assert_*
func_call
tests/tests/lpsolvers/seidel/test_lp2d.py
test_err2
197
null
hungpham2511/toppra
import toppra import pytest import numpy as np from numpy.testing import assert_allclose def give_a_2dof_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2], np.array([[0, 0], [1, 2.0], [1, 2.0]])) yield f def give_a_simple_scalar_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2]...
[0, 0])
assert_*
collection
tests/tests/interpolators/test_simple_path.py
test_path_interpolate_are_correct
61
null
hungpham2511/toppra
import pytest import numpy as np import numpy.testing as npt import toppra import toppra.constraint as constraint import cvxpy from ..testing_flags import FOUND_CXPY, FOUND_MOSEK, FOUND_OPENRAVEPY toppra.setup_logging(level="INFO") def basic_init_fixture(request): """ A fixture for testing basic capability of th...
cvxpy_result)
assert_*
variable
tests/tests/solverwrapper/test_basic_can_linear.py
test_basic_correctness
163
null
hungpham2511/toppra
import pytest import cvxpy as cvx import numpy as np import numpy.testing as npt import toppra as ta import toppra.constraint as constraint from toppra.constants import TINY, JVEL_MAXSD, SMALL from scipy.interpolate import CubicSpline def create_velocity_pc_fixtures(request): """Parameterized fixture to test Veloc...
[ [-1, 1], [-1.2, 1.2], [-2, 2], ])
assert_*
collection
tests/tests/constraint/test_joint_velocity.py
test_only_max_vel_given
141
null
hungpham2511/toppra
import toppra import pytest import numpy as np from numpy.testing import assert_allclose def give_a_2dof_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2], np.array([[0, 0], [1, 2.0], [1, 2.0]])) yield f def give_a_simple_scalar_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2]...
np.array([0.0, 2.0]))
assert_*
func_call
tests/tests/interpolators/test_simple_path.py
test_path_interval_is_correct
70
null
hungpham2511/toppra
import pytest import toppra.cpp as tac import numpy as np import msgpack pytestmark = pytest.mark.skipif( not tac.bindings_loaded(), reason="c++ bindings not built" ) def path(): c = np.array( [[-0.500000, -0.500000, 1.500000, 0.500000, 0.000000, 3.000000, 0.000000, 0.000000,], [-0.500000, -0...
[[0, 0], [1, 1], [0, 0]])
assert_*
collection
tests/tests/cpp/test_piecewise_poly_path.py
test_hermite
52
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt import pytest from toppra import SplineInterpolator from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def given_scalar_spline_interpolator(): sswp, wp, ss, path_interval = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2, 0.3, 0.5], [0, 0.5]] pi = Spli...
5
assert
numeric_literal
tests/tests/interpolators/test_spline_interpolator.py
test_5_dof
45
null
hungpham2511/toppra
import toppra import pytest import numpy as np from numpy.testing import assert_allclose def give_a_2dof_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2], np.array([[0, 0], [1, 2.0], [1, 2.0]])) yield f def give_a_simple_scalar_function_without_derivatives(): f = toppra.SimplePath([0, 1, 2]...
2.0)
assert_*
numeric_literal
tests/tests/interpolators/test_simple_path.py
test_correct_derivatives_as_specified
48
null
hungpham2511/toppra
import pytest import numpy as np import toppra def coefficients_functions(): "Coefficients for the equation: A(q) ddot q + dot q B(q) dot q + C(q) = w" def A(q): return np.array([[np.sin(q[0]), 0], [np.cos(q[1]), q[0] + q[1]]]) def B(q): ret = np.zeros((2, 2, 2)) ...
g[i])
assert_*
complex_expr
tests/tests/constraint/test_second_order.py
test_correctness
74
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt import pytest from toppra import SplineInterpolator from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def given_scalar_spline_interpolator(): sswp, wp, ss, path_interval = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2, 0.3, 0.5], [0, 0.5]] pi = Spli...
()
assert
collection
tests/tests/interpolators/test_spline_interpolator.py
test_scalar
35
null
hungpham2511/toppra
import toppra import pytest import numpy as np def accel_constraint(request): dof = 5 np.random.seed(0) alim_ = np.random.rand(5) alim = np.vstack((-alim_, alim_)).T constraint = toppra.constraint.JointAccelerationConstraint(alim) np.random.seed(0) path = toppra.SplineInterpolator(np.linsp...
ValueError)
pytest.raises
variable
tests/tests/constraint/test_robust_can_linear.py
test_negative_perb
55
null
hungpham2511/toppra
import toppra.solverwrapper.cy_seidel_solverwrapper as seidel import numpy as np from numpy import array import pytest import cvxpy as cvx testdata_correct = [ ([1, 2, 3.0], None, None, None, [-1, -1], [1, 1], [-1, 1], 1, 6, [1, 1], [-2, -4]), ([-2, 2, 2.0], None, None, None, [-1, -1], [1, 1], [-1, 1], ...
optval_expected)
assert_*
variable
tests/tests/lpsolvers/seidel/test_lp2d.py
test_correct
67
null
hungpham2511/toppra
import pytest import numpy as np import numpy.testing as npt import toppra as ta import toppra.constraint as constraint from toppra.constants import JACC_MAXU def create_acceleration_pc_fixtures(request): """ Parameterized Acceleration path constraint. Return: ------- data: A tuple. Contains path, s...
None
assert
none_literal
tests/tests/constraint/test_joint_acceleration.py
test_constraint_params
75
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt import pytest from toppra import SplineInterpolator from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def given_scalar_spline_interpolator(): sswp, wp, ss, path_interval = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2, 0.3, 0.5], [0, 0.5]] pi = Spli...
3
assert
numeric_literal
tests/tests/interpolators/test_spline_interpolator.py
test_1waypoints
55
null
hungpham2511/toppra
import pytest import toppra.cpp as tac import numpy as np import msgpack pytestmark = pytest.mark.skipif( not tac.bindings_loaded(), reason="c++ bindings not built" ) def path(): c = np.array( [[-0.500000, -0.500000, 1.500000, 0.500000, 0.000000, 3.000000, 0.000000, 0.000000,], [-0.500000, -0...
[0, 3])
assert_*
collection
tests/tests/cpp/test_piecewise_poly_path.py
test_interval
38
null
hungpham2511/toppra
import toppra import pytest import numpy as np def setup_geometric_path(): yield toppra.SplineInterpolator([0, 1, 2], [(0, 0), (1, 2), (2, 0)]) def test_initialzie(path): gridpoints = [0, 0.5, 1, 1.5, 2] velocities = [1, 2, 2, 1, 0] # xd = [1, 4, 4, 1, 0] # ud = [6.0, 0, -6.0, -2.0] path_new ...
(2,)
assert
collection
tests/tests/parametrize/test_const_accel.py
test_initialzie
24
null
hungpham2511/toppra
import pytest import toppra import numpy as np from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def barret_robot(rave_env): rave_env.Reset() rave_env.Load("data/lab1.env.xml") robot = rave_env.GetRobots()[0] yield robot @pytest.mark.skipif(not IMPORT_OPENRAVEPY, reason=IMPORT_OPENR...
2 * dof
assert
complex_expr
tests/tests/constraint/test_create_rave_torque.py
test_shape
30
null
hungpham2511/toppra
import pytest import numpy as np import toppra import cvxpy from ..testing_flags import FOUND_MOSEK @pytest.mark.skip(reason="Skip because it is hard to solve conic problems reliably.") @pytest.mark.parametrize("i", [0, 5, 9]) @pytest.mark.parametrize("H", [None]) @pytest.mark.parametrize("g", [np.array([0.2, -1]), np...
0
assert
numeric_literal
tests/tests/solverwrapper/test_basic_conic_can_linear.py
test_vel_robust_accel
74
null
hungpham2511/toppra
import pytest import numpy as np import toppra import cvxpy from ..testing_flags import FOUND_MOSEK @pytest.mark.skip(reason="Skip because it is hard to solve conic problems reliably.") @pytest.mark.parametrize("i", [0, 5, 9]) @pytest.mark.parametrize("H", [None]) @pytest.mark.parametrize("g", [np.array([0.2, -1]), np...
actual.flatten())
assert_*
func_call
tests/tests/solverwrapper/test_basic_conic_can_linear.py
test_vel_robust_accel
71
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt import pytest from toppra import SplineInterpolator from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def given_scalar_spline_interpolator(): sswp, wp, ss, path_interval = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2, 0.3, 0.5], [0, 0.5]] pi = Spli...
np.r_[1, 2, 3])
assert_*
complex_expr
tests/tests/interpolators/test_spline_interpolator.py
test_1waypoints
57
null
hungpham2511/toppra
import pytest import toppra import numpy as np from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def robot_fixture(rave_env): env = rave_env env.Reset() env.Load("data/lab1.env.xml") robot = env.GetRobots()[0] manipulator = robot.GetManipulators()[0] robot.SetActiveDOFs(mani...
traj.GetDuration() + 1
assert
func_call
tests/tests/retime/test_retime_with_openrave.py
test_retime_kinematics_ravetraj
62
null
hungpham2511/toppra
import pytest import cvxpy as cvx import numpy as np import numpy.testing as npt import toppra as ta import toppra.constraint as constraint from toppra.constants import TINY, JVEL_MAXSD, SMALL from scipy.interpolate import CubicSpline def create_velocity_pc_fixtures(request): """Parameterized fixture to test Veloc...
"Bad velocity limits"
assert
string_literal
tests/tests/constraint/test_joint_velocity.py
test_negative_velocity
159
null
hungpham2511/toppra
import pytest import numpy as np import toppra import toppra.constraint as constraint from toppra.solverwrapper.ecos_solverwrapper import ecosWrapper from toppra.solverwrapper.qpoases_solverwrapper import qpOASESSolverWrapper @pytest.mark.skip(reason="ecos solver is currently failing") @pytest.mark.parametrize("i", [0...
target_result)
assert_*
variable
tests/tests/solverwrapper/test_ecos_wrapper.py
test_linear_constraints_only
29
null
hungpham2511/toppra
import toppra.solverwrapper.cy_seidel_solverwrapper as seidel import numpy as np from numpy import array import pytest import cvxpy as cvx testdata_correct = [ ([1, 2, 3.0], None, None, None, [-1, -1], [1, 1], [-1, 1], 1, 6, [1, 1], [-2, -4]), ([-2, 2, 2.0], None, None, None, [-1, -1], [1, 1], [-1, 1], ...
optvar_expected)
assert_*
variable
tests/tests/lpsolvers/seidel/test_lp2d.py
test_correct
68
null
hungpham2511/toppra
import numpy as np import numpy.testing as npt import pytest from toppra import SplineInterpolator from ..testing_utils import IMPORT_OPENRAVEPY, IMPORT_OPENRAVEPY_MSG def given_scalar_spline_interpolator(): sswp, wp, ss, path_interval = [[0, 0.3, 0.5], [1, 2, 3], [0.0, 0.1, 0.2, 0.3, 0.5], [0, 0.5]] pi = Spli...
xs)
assert_*
variable
tests/tests/interpolators/test_spline_interpolator.py
test_2waypoints
71
null
tomerfiliba/plumbum
from __future__ import annotations from plumbum.cli.image import Image # noqa: F401 from plumbum.colorlib.names import FindNearest, color_html from plumbum.colorlib.styles import ( # noqa: F401 ANSIStyle, AttributeNotFound, Color, ColorNotFound, ) class TestNearestColor: def test_exact(self): ...
n
assert
variable
tests/test_color.py
test_exact
TestNearestColor
21
null
tomerfiliba/plumbum
from __future__ import annotations import pytest from plumbum import colors from plumbum.colorlib import htmlcolors from plumbum.colorlib.styles import ANSIStyle as Style from plumbum.colorlib.styles import ColorNotFound class TestANSIColor: def setup_method(self, method): # noqa: ARG002 colors.use_colo...
"\033[0m"
assert
string_literal
tests/test_factories.py
testColorStrings
TestANSIColor
41
null
tomerfiliba/plumbum
from __future__ import annotations import sys from collections import OrderedDict from contextlib import contextmanager from io import StringIO from plumbum.cli.terminal import Progress, ask, choose, hexdump, prompt def send_stdin(stdin="\n"): prevstdin = sys.stdin sys.stdin = StringIO(stdin) try: ...
"yellow"
assert
string_literal
tests/test_terminal.py
test_choose
TestTerminal
69
null
tomerfiliba/plumbum
from __future__ import annotations import contextlib from plumbum import local from plumbum._testtools import skip_on_windows class TestEnv: def test_dictlike(self): keys = {x.split("=")[0] for x in printenv().splitlines() if "=" in x} values = { x.split("=", 1)[1].strip() for x in p...
len(set(local.env.values()))
assert
func_call
tests/test_env.py
test_dictlike
TestEnv
30
null
tomerfiliba/plumbum
from __future__ import annotations import logging import os import socket import time from multiprocessing import Queue from threading import Thread import env import pytest import plumbum from plumbum import ( NOHUP, CommandNotFound, ProcessExecutionError, ProcessTimedOut, RemotePath, SshMac...
"baba"
assert
string_literal
tests/test_remote.py
test_env
BaseRemoteMachineTest
374
null
tomerfiliba/plumbum
from __future__ import annotations import logging import os import socket import time from multiprocessing import Queue from threading import Thread import env import pytest import plumbum from plumbum import ( NOHUP, CommandNotFound, ProcessExecutionError, ProcessTimedOut, RemotePath, SshMac...
env
assert
variable
tests/test_remote.py
test_env_special_characters
BaseRemoteMachineTest
407
null
tomerfiliba/plumbum
from __future__ import annotations from typing import TYPE_CHECKING import pytest import plumbum from plumbum._testtools import skip_on_windows @skip_on_windows @pytest.mark.timeout(3) def test_draining_stderr_with_stdout_redirect(tmp_path, generate_cmd, process_cmd): stdout, stderr = get_output_with_iter_lines...
0
assert
numeric_literal
tests/test_pipelines.py
test_draining_stderr_with_stdout_redirect
50
null
tomerfiliba/plumbum
from __future__ import annotations import pytest from plumbum import local from plumbum.cli import Config, ConfigINI fname = "test_config.ini" class TestConfig: def test_complex_ini(self): with Config(fname) as conf: conf["value"] = "normal" conf["newer.value"] = "other" ...
"other"
assert
string_literal
tests/test_config.py
test_complex_ini
TestConfig
46
null
tomerfiliba/plumbum
from __future__ import annotations import asyncio import sys import pytest from plumbum import async_local, local from plumbum._testtools import skip_on_windows from plumbum.commands import ProcessExecutionError from plumbum.commands.async_ import AsyncLocalCommand from plumbum.machines.local import AsyncLocalMachin...
3
assert
numeric_literal
tests/test_async_local.py
test_concurrent_execution
TestAsyncCmdImport
93
null
tomerfiliba/plumbum
from __future__ import annotations from plumbum import cli class TestProg: def test_failure(self, capsys): class MainValidator(cli.Application): @cli.positional(int, int, int) def main(self, myint, myint2, *mylist): print(myint, myint2, mylist) _, rc = Mai...
value
assert
variable
tests/test_validate.py
test_failure
TestProg
73
null
tomerfiliba/plumbum
from __future__ import annotations from plumbum import cli, local from plumbum.cli.terminal import get_terminal_size class TestCLI: def test_failures(self): _, rc = SimpleApp.run(["foo"], exit=False) assert rc ==
2
assert
numeric_literal
tests/test_cli.py
test_failures
TestCLI
219
null
tomerfiliba/plumbum
from __future__ import annotations from plumbum import cli, colors colors.use_color = 3 def make_app(): class SimpleApp(cli.Application): PROGNAME = colors.green VERSION = colors.red | "1.0.3" @cli.switch(["a"]) def spam(self): print("!!a") def main(self, *ar...
0
assert
numeric_literal
tests/test_clicolor.py
test_runs
TestSimpleApp
27
null
tomerfiliba/plumbum
from __future__ import annotations import pytest from plumbum.typed_env import TypedEnv class TestTypedEnv: def test_env(self): class E(TypedEnv): terminal = TypedEnv.Str("TERM") B = TypedEnv.Bool("BOOL", default=True) I = TypedEnv.Int(["INT", "INTEGER"]) # noqa: E741...
5
assert
numeric_literal
tests/test_typed_env.py
test_env
TestTypedEnv
54
null
tomerfiliba/plumbum
from __future__ import annotations import pytest from plumbum import SshMachine, local from plumbum._testtools import skip_on_windows from plumbum.path.utils import copy, delete, move @skip_on_windows @pytest.mark.ssh def test_copy_move_delete(): from plumbum.cmd import touch with local.tempdir() as dir: ...
s2
assert
variable
tests/test_utils.py
test_copy_move_delete
29
null
tomerfiliba/plumbum
from __future__ import annotations import sys from collections import OrderedDict from contextlib import contextmanager from io import StringIO from plumbum.cli.terminal import Progress, ask, choose, hexdump, prompt def send_stdin(stdin="\n"): prevstdin = sys.stdin sys.stdin = StringIO(stdin) try: ...
capsys.readouterr()[0]
assert
func_call
tests/test_terminal.py
test_typefail
TestPrompt
44
null
tomerfiliba/plumbum
from __future__ import annotations import logging import os import socket import time from multiprocessing import Queue from threading import Thread import env import pytest import plumbum from plumbum import ( NOHUP, CommandNotFound, ProcessExecutionError, ProcessTimedOut, RemotePath, SshMac...
".gz"
assert
string_literal
tests/test_remote.py
test_suffix
TestRemotePath
120
null
tomerfiliba/plumbum
from __future__ import annotations import pytest from plumbum import SshMachine, local from plumbum._testtools import skip_on_windows from plumbum.path.utils import copy, delete, move @skip_on_windows @pytest.mark.ssh def test_copy_move_delete(): from plumbum.cmd import touch with local.tempdir() as dir: ...
s3
assert
variable
tests/test_utils.py
test_copy_move_delete
34
null
tomerfiliba/plumbum
from __future__ import annotations import logging import os import socket import time from multiprocessing import Queue from threading import Thread import env import pytest import plumbum from plumbum import ( NOHUP, CommandNotFound, ProcessExecutionError, ProcessTimedOut, RemotePath, SshMac...
1
assert
numeric_literal
tests/test_remote.py
test_iter_lines_error
BaseRemoteMachineTest
443
null
tomerfiliba/plumbum
from __future__ import annotations import sys from collections import OrderedDict from contextlib import contextmanager from io import StringIO from plumbum.cli.terminal import Progress, ask, choose, hexdump, prompt def send_stdin(stdin="\n"): prevstdin = sys.stdin sys.stdin = StringIO(stdin) try: ...
11
assert
numeric_literal
tests/test_terminal.py
test_choose
TestTerminal
79
null
tomerfiliba/plumbum
from __future__ import annotations import pytest from plumbum import colors from plumbum.colorlib import htmlcolors from plumbum.colorlib.styles import ANSIStyle as Style from plumbum.colorlib.styles import ColorNotFound class TestHTMLColor: def test_from_ansi_string_foreground_and_background(self): # A...
expected
assert
variable
tests/test_factories.py
test_from_ansi_string_foreground_and_background
TestHTMLColor
242
null
tomerfiliba/plumbum
from __future__ import annotations import pytest from plumbum import colors from plumbum.colorlib import htmlcolors from plumbum.colorlib.styles import ANSIStyle as Style from plumbum.colorlib.styles import ColorNotFound class TestANSIColor: def setup_method(self, method): # noqa: ARG002 colors.use_colo...
10
assert
numeric_literal
tests/test_factories.py
testColorSlice
TestANSIColor
30
null
tomerfiliba/plumbum
from __future__ import annotations import logging import os import socket import time from multiprocessing import Queue from threading import Thread import env import pytest import plumbum from plumbum import ( NOHUP, CommandNotFound, ProcessExecutionError, ProcessTimedOut, RemotePath, SshMac...
3
assert
numeric_literal
tests/test_remote.py
test_iter_lines_timeout
BaseRemoteMachineTest
434
null
tomerfiliba/plumbum
from __future__ import annotations from typing import TYPE_CHECKING import pytest import plumbum from plumbum._testtools import skip_on_windows @skip_on_windows @pytest.mark.timeout(3) def test_draining_stderr(generate_cmd, process_cmd): stdout, stderr = get_output_with_iter_lines( generate_cmd | proces...
5000
assert
numeric_literal
tests/test_pipelines.py
test_draining_stderr
24
null
tomerfiliba/plumbum
from __future__ import annotations import logging import os import socket import time from multiprocessing import Queue from threading import Thread import env import pytest import plumbum from plumbum import ( NOHUP, CommandNotFound, ProcessExecutionError, ProcessTimedOut, RemotePath, SshMac...
".txt"
assert
string_literal
tests/test_remote.py
test_suffix
TestRemotePath
118
null
tomerfiliba/plumbum
from __future__ import annotations from plumbum import cli class TestValidator: def test_named(self): class Try: @cli.positional(x=abs, y=str) def main(selfy, x, y): pass assert Try.main.positional == [abs, str] assert Try.main.positional_varargs i...
None
assert
none_literal
tests/test_validate.py
test_named
TestValidator
14
null
tomerfiliba/plumbum
from __future__ import annotations import unittest from parallel import Cluster from plumbum import SshMachine, local TEST_HOST = "127.0.0.1" class TestParallel(unittest.TestCase): def setUp(self): self.remotes = [] def connect(self): m = SshMachine(TEST_HOST) self.remotes.append(m...
4
assert
numeric_literal
experiments/test_parallel.py
test_sessions
TestParallel
46
null
tomerfiliba/plumbum
from __future__ import annotations import contextlib from plumbum import local from plumbum._testtools import skip_on_windows class TestEnv: @skip_on_windows def test_home(self): assert local.env.home == local.env["HOME"] old_home = local.env.home with local.env(): local....
"Nobody"
assert
string_literal
tests/test_env.py
test_home
TestEnv
60
null
tomerfiliba/plumbum
from __future__ import annotations from plumbum import cli class TestProg: def test_defaults(self, capsys): class MainValidator(cli.Application): @cli.positional(int, int) def main(self, myint, myint2=2): print(repr(myint), repr(myint2)) _, rc = MainValida...
"1 3"
assert
string_literal
tests/test_validate.py
test_defaults
TestProg
89
null
tomerfiliba/plumbum
from __future__ import annotations import os import time import psutil import pytest from plumbum import NOHUP, local from plumbum._testtools import skip_on_windows from plumbum.path.utils import delete class TestNohupLocal: def read_file(self, filename): assert filename in os.listdir(".") with...
"Starting test\n1\n"
assert
string_literal
tests/test_nohup.py
test_slow
TestNohupLocal
33
null
tomerfiliba/plumbum
from __future__ import annotations import sys from collections import OrderedDict from contextlib import contextmanager from io import StringIO from plumbum.cli.terminal import Progress, ask, choose, hexdump, prompt def send_stdin(stdin="\n"): prevstdin = sys.stdin sys.stdin = StringIO(stdin) try: ...
("a", "b")
assert
collection
tests/test_terminal.py
test_choose_dict
TestTerminal
108
null