F.F                                                                      [100%]
=================================== FAILURES ===================================
___________ test_lp_portfolio_aligns_prices_by_ticker[price_order0] ____________

price_order = ['AAA', 'BBB']

    @pytest.mark.parametrize("price_order", [["AAA", "BBB"], ["BBB", "AAA"]])
    def test_lp_portfolio_aligns_prices_by_ticker(price_order):
        weights = {"BBB": 0.5, "AAA": 0.5}
        prices = pd.Series({"AAA": 10.0, "BBB": 1000.0}).loc[price_order]
        allocation, leftover = DiscreteAllocation(weights, prices).lp_portfolio(
            solver="SCIPY"
        )
    
>       assert allocation == {"BBB": 5, "AAA": 500}
E       AssertionError: assert {'BBB': 500, 'AAA': 5} == {'BBB': 5, 'AAA': 500}
E         
E         Differing items:
E         {'AAA': 5} != {'AAA': 500}
E         {'BBB': 500} != {'BBB': 5}
E         Use -v to get more diff

tests/test_discrete_allocation.py:18: AssertionError
__________ test_lp_portfolio_reordered_stock_prices_preserves_budget ___________

    def test_lp_portfolio_reordered_stock_prices_preserves_budget():
        weights = setup_efficient_frontier().max_sharpe(risk_free_rate=0.02)
        prices = get_latest_prices(get_data()).iloc[::-1]
        allocation, leftover = DiscreteAllocation(weights, prices).lp_portfolio(
            solver="SCIPY"
        )
    
        spent = sum(prices[ticker] * count for ticker, count in allocation.items())
>       assert spent <= 10000 + 1e-6
E       assert np.float64(31136.770546) <= (10000 + 1e-06)

tests/test_discrete_allocation.py:32: AssertionError
----------------------------- Captured stdout call -----------------------------
===============================================================================
                                     CVXPY                                     
                                     v1.9.3                                    
===============================================================================
-------------------------------------------------------------------------------
                                  Compilation                                  
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
                                Numerical solver                               
-------------------------------------------------------------------------------
-----------------------------------------------------------------
           OSQP v1.0.0  -  Operator Splitting QP Solver
              (c) The OSQP Developer Team
-----------------------------------------------------------------
problem:  variables n = 21, constraints m = 43
          nnz(P) + nnz(A) = 312
settings: algebra = Built-in,
          OSQPInt = 4 bytes, OSQPFloat = 8 bytes,
          linear system solver = QDLDL v0.1.8,
          eps_abs = 1.0e-05, eps_rel = 1.0e-05,
          eps_prim_inf = 1.0e-04, eps_dual_inf = 1.0e-04,
          rho = 1.00e-01 (adaptive: 50 iterations),
          sigma = 1.00e-06, alpha = 1.60, max_iter = 10000
          check_termination: on (interval 25, duality gap: on),
          time_limit: 1.00e+10 sec,
          scaling: on (10 iterations), scaled_termination: off
          warm starting: on, polishing: on, 
iter   objective    prim res   dual res   gap        rel kkt    rho         time
   1   0.0000e+00   1.00e+00   2.71e+02  -7.34e+02   2.71e+02   1.00e-01    5.39e-05s
 150   6.0583e-01   2.34e-06   5.14e-07   1.11e-06   2.34e-06   1.00e-01    1.79e-04s
plsh   6.0583e-01   4.44e-16   8.88e-16   8.88e-16   8.88e-16   --------    2.14e-04s

status:               solved
solution polishing:   successful
number of iterations: 150
optimal objective:    0.6058
dual objective:       0.6058
duality gap:          8.8818e-16
primal-dual integral: 7.3438e+02
run time:             2.14e-04s
optimal rho estimate: 7.60e-02

-------------------------------------------------------------------------------
                                    Summary                                    
-------------------------------------------------------------------------------
----------------------------- Captured stderr call -----------------------------
(CVXPY) Oct 22 11:05:28 AM: Your problem has 21 variables, 43 constraints, and 0 parameters.
(CVXPY) Oct 22 11:05:28 AM: It is compliant with the following grammars: DCP, DQCP
(CVXPY) Oct 22 11:05:28 AM: DCP verification time: 0.0001 seconds.
(CVXPY) Oct 22 11:05:28 AM: Expression tree has 6 nodes.
(CVXPY) Oct 22 11:05:28 AM: (If you need to solve this problem multiple times, but with different data, consider using parameters.)
(CVXPY) Oct 22 11:05:28 AM: CVXPY will first compile your problem; then, it will invoke a numerical solver to obtain a solution.
(CVXPY) Oct 22 11:05:28 AM: Your problem is compiled with the CPP canonicalization backend.
(CVXPY) Oct 22 11:05:28 AM: Compiling problem (target solver=OSQP).
(CVXPY) Oct 22 11:05:28 AM: Reduction chain: Dcp2Cone -> CvxAttr2Constr -> EliminateZeroSized -> ConeMatrixStuffing -> OSQP
(CVXPY) Oct 22 11:05:28 AM: Applying reduction Dcp2Cone
(CVXPY) Oct 22 11:05:28 AM: Applying reduction CvxAttr2Constr
(CVXPY) Oct 22 11:05:28 AM: Applying reduction EliminateZeroSized
(CVXPY) Oct 22 11:05:28 AM: Applying reduction ConeMatrixStuffing
(CVXPY) Oct 22 11:05:28 AM: Applying reduction OSQP
(CVXPY) Oct 22 11:05:28 AM: Finished problem compilation (took 4.180e-03 seconds).
(CVXPY) Oct 22 11:05:28 AM: Invoking solver OSQP  to obtain a solution.
(CVXPY) Oct 22 11:05:28 AM: Problem status: optimal
(CVXPY) Oct 22 11:05:28 AM: Optimal value: 6.058e-01
(CVXPY) Oct 22 11:05:28 AM: Compilation took 4.180e-03 seconds
(CVXPY) Oct 22 11:05:28 AM: Solver (including time spent in interface) took 1.243e-03 seconds
------------------------------ Captured log call -------------------------------
INFO     __cvxpy__:problem.py:1031 Your problem has 21 variables, 43 constraints, and 0 parameters.
INFO     __cvxpy__:problem.py:1044 It is compliant with the following grammars: DCP, DQCP
INFO     __cvxpy__:problem.py:1047 DCP verification time: 0.0001 seconds.
INFO     __cvxpy__:problem.py:1049 Expression tree has 6 nodes.
INFO     __cvxpy__:problem.py:1051 (If you need to solve this problem multiple times, but with different data, consider using parameters.)
INFO     __cvxpy__:problem.py:1054 CVXPY will first compile your problem; then, it will invoke a numerical solver to obtain a solution.
INFO     __cvxpy__:problem.py:1057 Your problem is compiled with the CPP canonicalization backend.
INFO     __cvxpy__:problem.py:874 Compiling problem (target solver=OSQP).
INFO     __cvxpy__:problem.py:876 Reduction chain: Dcp2Cone -> CvxAttr2Constr -> EliminateZeroSized -> ConeMatrixStuffing -> OSQP
INFO     __cvxpy__:chain.py:96 Applying reduction Dcp2Cone
INFO     __cvxpy__:chain.py:96 Applying reduction CvxAttr2Constr
INFO     __cvxpy__:chain.py:96 Applying reduction EliminateZeroSized
INFO     __cvxpy__:chain.py:96 Applying reduction ConeMatrixStuffing
INFO     __cvxpy__:chain.py:96 Applying reduction OSQP
INFO     __cvxpy__:problem.py:886 Finished problem compilation (took 4.180e-03 seconds).
INFO     __cvxpy__:problem.py:1123 Invoking solver OSQP  to obtain a solution.
INFO     __cvxpy__:problem.py:1151 Problem status: optimal
INFO     __cvxpy__:problem.py:1153 Optimal value: 6.058e-01
INFO     __cvxpy__:problem.py:1154 Compilation took 4.180e-03 seconds
INFO     __cvxpy__:problem.py:1155 Solver (including time spent in interface) took 1.243e-03 seconds
=========================== short test summary info ============================
FAILED tests/test_discrete_allocation.py::test_lp_portfolio_aligns_prices_by_ticker[price_order0]
FAILED tests/test_discrete_allocation.py::test_lp_portfolio_reordered_stock_prices_preserves_budget
2 failed, 1 passed, 17 deselected in 1.42s
