Skip to content

[Bug] One unit test failing on main, Python 3.9 only #1331

@esantorella

Description

@esantorella

🐛 Bug

One unit test is failing. This happened for MacOS, Ubuntu, and Windows, but on Python 3.9 only (not 3.7). This happened on main, as well as in PRs #1327 , #1328 , #1329 , and #1330, none of which could have plausibly broken this test.

To reproduce

Actions

** Stack trace/error message **

=================================== FAILURES ===================================
___________________ TestSampleUtils.test_find_interior_point ___________________

self = <test.utils.test_sampling.TestSampleUtils testMethod=test_find_interior_point>

    def test_find_interior_point(self):
        # basic problem: 1 <= x_1 <= 2, 2 <= x_2 <= 3
        A = np.concatenate([np.eye(2), -np.eye(2)], axis=0)
        b = np.array([2.0, 3.0, -1.0, -2.0])
        x = find_interior_point(A=A, b=b)
        self.assertTrue(np.allclose(x, np.array([1.5, 2.5])))
        # problem w/ negatives variables: -2 <= x_1 <= -1, -3 <= x_2 <= -2
        b = np.array([-1.0, -2.0, 2.0, 3.0])
        x = find_interior_point(A=A, b=b)
        self.assertTrue(np.allclose(x, np.array([-1.5, -2.5])))
        # problem with bound on a single variable: x_1 <= 0
        A = np.array([[1.0, 0.0]])
        b = np.zeros(1)
        x = find_interior_point(A=A, b=b)
        self.assertLessEqual(x[0].item(), 0.0)
        # unbounded problem: x >= 3
        A = np.array([[-1.0]])
        b = np.array([-3.0])
        x = find_interior_point(A=A, b=b)
>       self.assertAlmostEqual(x.item(), 6.201544, places=4)
E       AssertionError: 5.0 != 6.201544 within 4 places (1.2015440000000002 difference)

test/utils/test_sampling.py:311: AssertionError

Expected Behavior

x.item() should be close to 6.201544 rather than being 5.0.

System information

GitHub Actions on current commit (147cf75)

Additional context

The last overnight run passed, so I think #1318 was the only commit recent enough to do this.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions