The test test_removeVar2 fails: TypeError: 'NoneType' object is not subscriptable
- Dominant language
- JetBrains MPS
- Stars
- 192
- Forks
- 70
- PR merge metrics
- No merged PRs in 30d
Description
```
=================================== FAILURES ===================================
_________________________ TestModeling.test_removeVar2 _________________________
self =
def test_removeVar2(self):
s = CyClpSimplex()
fp = os.path.join(currentFilePath, '../../input/p0033.mps')
s.extractCyLPModel(fp)
y = s.addVariable('y', 3)
s.primal()
x = s.getVarByName('x')
> s.addConstraint(x[1] + y[1] >= 1.2)
^^^^
E TypeError: 'NoneType' object is not subscriptable
stage/usr/local/lib/python3.12/site-packages/cylp/py/modeling/test_modeling.py:227: TypeError
=============================== warnings summary ===============================
stage/usr/local/lib/python3.12/site-packages/cylp/py/modeling/test_modeling.py: 13 warnings
/usr/ports/math/py-CyLP/work-py312/stage/usr/local/lib/python3.12/site-packages/cylp/py/modeling/test_modeling.py:23: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
self.A = np.matrix([[1, 2, 3, 3, 4], [3, 2, 1, 2, 5]])
stage/usr/local/lib/python3.12/site-packages/cylp/py/modeling/test_modeling.py: 13 warnings
/usr/ports/math/py-CyLP/work-py312/stage/usr/local/lib/python3.12/site-packages/cylp/py/modeling/test_modeling.py:24: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
self.B = np.matrix([[0, 0, 0, -1.5, -1.5], [-3, 0, 0, -2,0 ]])
stage/usr/local/lib/python3.12/site-packages/cylp/py/modeling/test_modeling.py: 13 warnings
/usr/ports/math/py-CyLP/work-py312/stage/usr/local/lib/python3.12/site-packages/cylp/py/modeling/test_modeling.py:25: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
self.D = np.matrix([[1, 3, 1, 4], [2, 1,3, 5]])
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================== 1 failed, 12 passed, 39 warnings in 0.17s ===================
```
Python-3.12
FreeBSD 15.1 STABLE
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce TestModeling.test_removeVar2 from cylp/py/modeling/test_modeling.py on Python 3.12 and inspect the setup around getVarByName('x') before the failing constraint. Trace why x is None, then verify that the focused test and the full modeling test file pass without the TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100