repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
cvxpy
cvxpy/tests/test_KKT.py
.py
import numpy as np import cvxpy as cp from cvxpy.tests import solver_test_helpers as STH from cvxpy.tests.base_test import BaseTest from cvxpy.tests.test_cone2cone import TestPowND class TestKKT_LPs(BaseTest): def test_lp_1(self, places=4): # typical LP sth = STH.lp_1() sth.solve(solver=...
382
13,688
cvxpy
cvxpy/tests/test_quad_form.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
358
13,856
cvxpy
cvxpy/tests/test_dpp.py
.py
import warnings import numpy as np import pytest import cvxpy as cp import cvxpy.error as error from cvxpy.tests.base_test import BaseTest SOLVER = cp.CLARABEL class TestDcp(BaseTest): def test_multiply_scalar_params_not_dpp(self) -> None: x = cp.Parameter() product = x * x self.assertF...
957
36,828
cvxpy
cvxpy/tests/test_canon_sign.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
56
2,064
cvxpy
cvxpy/tests/test_nonlinear_atoms.py
.py
""" Copyright 2013 Steven Diamond, Eric Chu Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing...
233
8,107
cvxpy
cvxpy/tests/test_attributes.py
.py
import sys import numpy as np import pytest import scipy.sparse as sp import cvxpy as cp from cvxpy.constraints.nonpos import Inequality from cvxpy.constraints.psd import PSD from cvxpy.constraints.zero import Equality from cvxpy.reductions.cvx_attr2constr import CvxAttr2Constr class TestAttributes: @pytest.ma...
601
24,177
cvxpy
cvxpy/tests/test_domain.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
193
7,205
cvxpy
cvxpy/tests/test_matrices.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
134
5,053
cvxpy
cvxpy/tests/test_quad_dpp.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
372
13,509
cvxpy
cvxpy/tests/test_errors.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
125
4,296
cvxpy
cvxpy/tests/test_mip_vars.py
.py
""" Copyright 2013 Steven Diamond, Eric Chu Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing...
222
8,251
cvxpy
cvxpy/tests/test_constant.py
.py
import numpy as np import pytest import scipy.sparse as sp import scipy.sparse.linalg as sparla import cvxpy as cp import cvxpy.settings as s from cvxpy import psd_wrap def test_is_psd() -> None: n = 50 # trivial cases psd = np.eye(n) nsd = -np.eye(n) assert cp.Constant(psd).is_psd() asser...
123
3,908
cvxpy
cvxpy/tests/test_objectives.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
187
7,082
cvxpy
cvxpy/tests/test_zero_sized.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
320
12,561
cvxpy
cvxpy/tests/test_nlp_namespace.py
.py
"""Tests for cp.nlp namespace.""" import cvxpy as cp from cvxpy.atoms.elementwise.hyperbolic import tanh from cvxpy.atoms.elementwise.normcdf import normcdf from cvxpy.atoms.elementwise.trig import cos, sin class TestNLPNamespace: def test_nlp_namespace_accessible(self): """Test that cp.nlp submodule is a...
44
1,532
cvxpy
cvxpy/tests/test_linear_cone.py
.py
""" Copyright 2013 Steven Diamond, 2017 Robin Verschueren Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
357
16,631
cvxpy
cvxpy/tests/test_canon_methods.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
65
2,830
cvxpy
cvxpy/tests/test_versioning.py
.py
""" Copyright 2022, the CVXPY developers. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
47
1,894
cvxpy
cvxpy/tests/test_python_backends.py
.py
from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass import numpy as np import pytest import scipy.sparse as sp import cvxpy as cp import cvxpy.settings as s from cvxpy.lin_ops.backends import ( CooCanonBackend, CooTensor, PythonCanonBackend, SciPy...
3,562
132,597
cvxpy
cvxpy/tests/test_gurobi_write.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
48
1,260
cvxpy
cvxpy/tests/test_bounds.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
1,232
47,471
cvxpy
cvxpy/tests/test_atoms.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
3,118
123,650
cvxpy
cvxpy/tests/test_grad.py
.py
""" Copyright 2013 Steven Diamond, 2025 CVXPY authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
1,237
48,251
cvxpy
cvxpy/tests/test_parametric_bounds.py
.py
"""Tests for parametric (expression) bounds on variables.""" import numpy as np import pytest import cvxpy as cp import cvxpy.error as error import cvxpy.reductions.eval_params SOLVER = cp.CLARABEL BOUNDED_SOLVERS = ["HIGHS", "DAQP"] def _solver_available(solver_name): try: cp.Problem(cp.Minimize(0)).s...
278
10,184
cvxpy
cvxpy/tests/solver_test_helpers.py
.py
""" Copyright 2019, the CVXPY developers. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
1,725
62,367
cvxpy
cvxpy/tests/test_lin_ops.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
220
7,993
cvxpy
cvxpy/tests/test_fuzz_reshape.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
255
10,703
cvxpy
cvxpy/tests/test_openmp_conflict.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
78
2,806
cvxpy
cvxpy/tests/test_dqcp.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
838
32,040
cvxpy
cvxpy/tests/test_copt_write.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
49
1,252
cvxpy
cvxpy/tests/test_backend_selection.py
.py
"""Tests for canonicalization backend selection logic. The backend selection priority is: 1. User-specified backend (via canon_backend parameter) 2. COO for DPP problems with total parameter size >= DPP_PARAM_THRESHOLD (1000) 3. CPP if supported 4. SCIPY as fallback when CPP doesn't work """ from __future__ import an...
223
8,797
cvxpy
cvxpy/tests/test_monotonicity.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
89
2,948
cvxpy
cvxpy/tests/test_convolution.py
.py
""" Copyright 2013 Steven Diamond, Eric Chu Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing...
163
5,725
cvxpy
cvxpy/tests/test_scalarize.py
.py
import pytest import cvxpy as cp from cvxpy.error import DCPError from cvxpy.tests.base_test import BaseTest from cvxpy.transforms import scalarize class ScalarizeTest(BaseTest): """ Tests for the scalarize transform. """ def setUp(self) -> None: self.x = cp.Variable() obj1 = cp.Min...
491
19,758
cvxpy
cvxpy/tests/test_power_tools.py
.py
""" Copyright 2022, the CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, s...
161
6,249
cvxpy
cvxpy/tests/test_perspective.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
479
13,345
cvxpy
cvxpy/tests/test_solver_inverse_data.py
.py
""" Copyright 2025 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
45
1,619
cvxpy
cvxpy/tests/test_param_cone_prog.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
154
6,492
cvxpy
cvxpy/tests/test_cone2cone.py
.py
""" Copyright 2020, the CVXPY developers. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
1,349
53,266
cvxpy
cvxpy/tests/test_expressions.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
2,194
83,657
cvxpy
cvxpy/tests/test_matrix_utilities.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
62
2,340
cvxpy
cvxpy/tests/test_examples.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
630
20,386
cvxpy
cvxpy/tests/test_curvature.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
85
3,491
cvxpy
cvxpy/tests/test_expression_methods.py
.py
""" Copyright 2023 CVXPY Developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
423
14,675
cvxpy
cvxpy/tests/test_quantum_rel_entr.py
.py
import platform import sys import numpy as np import pytest import cvxpy as cp from cvxpy.atoms.affine.kron import kron from cvxpy.atoms.affine.partial_trace import partial_trace from cvxpy.atoms.affine.wraps import hermitian_wrap from cvxpy.tests import solver_test_helpers as STH def applychan(chan: np.ndarray, rh...
187
6,641
cvxpy
cvxpy/tests/test_valinvec2mixedint.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
411
14,232
cvxpy
cvxpy/tests/test_conic_solvers.py
.py
""" Copyright 2019, the CVXPY developers. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
3,663
137,838
cvxpy
cvxpy/tests/test_complex.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
1,246
48,577
cvxpy
cvxpy/tests/ram_limited.py
.py
""" Copyright 2020, the CVXPY developers. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
69
1,963
cvxpy
cvxpy/tests/test_clarabel.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
129
5,365
cvxpy
cvxpy/tests/test_labels.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
520
16,462
cvxpy
cvxpy/tests/test_quadratic.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
215
7,085
cvxpy
cvxpy/tests/test_suppfunc.py
.py
""" Copyright 2019, the cvxpy developers. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
257
9,984
cvxpy
cvxpy/tests/test_einsum.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
302
11,876
cvxpy
cvxpy/tests/test_qp_solvers.py
.py
""" Copyright 2013 Steven Diamond, 2017 Robin Verschueren Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agree...
937
33,509
cvxpy
cvxpy/tests/test_logic.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
375
14,233
cvxpy
cvxpy/tests/test_dgp.py
.py
import numpy as np import scipy.sparse as sp import cvxpy from cvxpy.tests.base_test import BaseTest class TestDgp(BaseTest): def test_product(self) -> None: x = cvxpy.Variable((), pos=True) y = cvxpy.Variable((), pos=True) prod = x * y self.assertTrue(prod.is_dgp()) self....
414
16,138
cvxpy
cvxpy/tests/test_constant_atoms.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
408
19,110
cvxpy
cvxpy/tests/test_linalg_utils.py
.py
""" Copyright 2023, the CVXPY Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
184
6,985
cvxpy
cvxpy/tests/test_problem_form.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
373
15,451
cvxpy
cvxpy/tests/test_constraints.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
965
39,723
cvxpy
cvxpy/tests/test_von_neumann_entr.py
.py
""" Copyright, 2022 - the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, s...
297
10,653
cvxpy
cvxpy/tests/test_custom_solver.py
.py
import unittest import cvxpy as cp from cvxpy.reductions.solvers.conic_solvers.scs_conif import SCS from cvxpy.reductions.solvers.qp_solvers.osqp_qpif import OSQP class CustomQPSolverCalled(Exception): pass class CustomConicSolverCalled(Exception): pass class CustomQPSolver(OSQP): def name(self) -> s...
111
3,939
cvxpy
cvxpy/tests/test_nd_matmul.py
.py
""" Comprehensive tests for ND matrix multiplication in CVXPY. Tests cover: 1. Core functionality (2D constant @ higher-dim variable) 2. Parametric tests (Parameter @ Variable) 3. Broadcasting (batch dimension size 1) 4. Edge cases (B=1, non-square, n=1, k=1, large batch, errors) All tests are parametrized by backend...
805
29,588
cvxpy
cvxpy/tests/test_base_classes.py
.py
import inspect import numpy as np import pytest from cvxpy.atoms.affine.affine_atom import AffAtom from cvxpy.atoms.atom import Atom from cvxpy.constraints.constraint import Constraint from cvxpy.expressions.expression import Expression from cvxpy.expressions.leaf import Leaf from cvxpy.interface.base_matrix_interfac...
76
2,473
cvxpy
cvxpy/tests/test_param_quad_prog.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
187
7,735
cvxpy
cvxpy/tests/test_semidefinite_vars.py
.py
""" Copyright 2013 Steven Diamond, Eric Chu Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing...
85
3,230
cvxpy
cvxpy/tests/test_problem.py
.py
""" Copyright 2017 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
2,373
95,102
cvxpy
cvxpy/tests/test_solver_data_validation.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
60
2,265
cvxpy
cvxpy/tests/test_coeff_extractor.py
.py
from dataclasses import dataclass import numpy as np import pytest import cvxpy as cp from cvxpy.atoms.quad_form import SymbolicQuadForm from cvxpy.lin_ops.canon_backend import TensorRepresentation from cvxpy.utilities.coeff_extractor import CoeffExtractor @dataclass class MockInverseData: var_offsets: dict ...
431
15,308
cvxpy
cvxpy/tests/test_derivative.py
.py
import warnings import numpy as np import cvxpy as cp import cvxpy.settings as s from cvxpy.tests.base_test import BaseTest warnings.filterwarnings("ignore") SOLVE_METHODS = [s.CLARABEL, s.SCS, ] EPS_NAME = {s.SCS: "eps", s.CLARABEL: "tol_gap_abs"} MAX_ITERS_NAME = {s.SCS: "max_iters", s.CL...
874
34,473
cvxpy
cvxpy/tests/test_copy.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
123
2,983
cvxpy
cvxpy/tests/test_soc_dim3.py
.py
""" Copyright 2025, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
349
12,718
cvxpy
cvxpy/tests/base_test.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
48
1,497
cvxpy
cvxpy/tests/test_complex_dpp.py
.py
""" Copyright 2024 - the CVXPY Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
192
7,424
cvxpy
cvxpy/tests/test_scopes.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
64
2,025
cvxpy
cvxpy/tests/test_dgp2dcp.py
.py
import numpy as np import pytest import cvxpy import cvxpy.error as error import cvxpy.reductions.dgp2dcp.canonicalizers as dgp_atom_canon from cvxpy.atoms.affine.add_expr import AddExpression from cvxpy.reductions import solution from cvxpy.settings import SOLVER_ERROR from cvxpy.tests.base_test import BaseTest SOLV...
660
27,402
cvxpy
cvxpy/tests/test_kron_canon.py
.py
""" Copyright 2022, the CVXPY developers. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
198
7,580
cvxpy
cvxpy/tests/test_interfaces.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
145
6,304
cvxpy
cvxpy/tests/test_clarabel_warm_start.py
.py
import numpy as np import cvxpy as cp def test_clarabel_warm_start_sparsity_change(): """ Test that Clarabel gracefully falls back to new_solver() if sparsity changes during a warm start, preventing a Data formatting error. (Issue #2800) """ x = cp.Variable(2) p = cp.Parameter(2) # Using...
29
949
cvxpy
cvxpy/tests/test_pow_cone_nd.py
.py
""" Copyright 2025 CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
263
10,355
cvxpy
cvxpy/tests/test_sign.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
70
2,694
cvxpy
cvxpy/tests/test_dgp_dpp.py
.py
""" Tests for DGP (Disciplined Geometric Programming) with DPP (Disciplined Parametrized Programming). This verifies the fix for issue #3004: DGP problems can now have get_problem_data(gp=True) called without all parameters having values. This is useful when the problem is DPP. """ import numpy as np import pytest im...
215
8,697
cvxpy
cvxpy/tests/test_dcp2cone_cse.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
260
10,734
cvxpy
cvxpy/tests/test_power_atom.py
.py
""" Copyright 2025 CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
371
15,433
cvxpy
cvxpy/tests/test_shape.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
95
3,231
cvxpy
cvxpy/tests/nlp_tests/test_huber_sum_largest.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
138
4,649
cvxpy
cvxpy/tests/nlp_tests/derivative_checker.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
274
10,240
cvxpy
cvxpy/tests/nlp_tests/test_dnlp.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
142
4,400
cvxpy
cvxpy/tests/nlp_tests/test_power_flow.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
117
4,918
cvxpy
cvxpy/tests/nlp_tests/__init__.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
17
563
cvxpy
cvxpy/tests/nlp_tests/test_risk_parity.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
124
4,830
cvxpy
cvxpy/tests/nlp_tests/test_affine_atoms.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
169
5,867
cvxpy
cvxpy/tests/nlp_tests/test_best_of.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
135
5,458
cvxpy
cvxpy/tests/nlp_tests/test_hyperbolic.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
70
2,379
cvxpy
cvxpy/tests/nlp_tests/test_sum.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
105
3,685
cvxpy
cvxpy/tests/nlp_tests/test_prod.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
287
10,656
cvxpy
cvxpy/tests/nlp_tests/test_log_sum_exp.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
78
2,588
cvxpy
cvxpy/tests/nlp_tests/test_quasi_newton.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
200
7,900
cvxpy
cvxpy/tests/nlp_tests/test_abs.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
136
5,078