Skip to content

Commit 2b5e400

Browse files
authored
relax tests
tests were failing with a within numerical noise error: ``` E AssertionError: E Arrays are not equal E E Mismatched elements: 103 / 145 (71%) E Max absolute difference: 2.22044605e-16 E Max relative difference: 2.11475965e-16 E x: array([[0.960134], E [1.143682], E [1.049976],... E y: array([[0.960134], E [1.143682], E [1.049976],... ```
1 parent 64e3ad7 commit 2b5e400

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

linearmodels/tests/panel/test_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_valid_weight_shape(data):
5151
missing = PanelData(data.y).isnull | PanelData(data.x).isnull
5252
expected = weights[~missing.squeeze()][:, None]
5353
expected = expected / expected.mean()
54-
assert_equal(w, expected)
54+
assert w == pytest.approx(expected)
5555

5656
# Per time
5757
if isinstance(data.x, pd.DataFrame):
@@ -72,7 +72,7 @@ def test_valid_weight_shape(data):
7272
expected = expected.T.ravel()
7373
expected = expected[~missing.squeeze()][:, None]
7474
expected = expected / expected.mean()
75-
assert_equal(w, expected)
75+
assert w == pytest.approx(expected)
7676

7777
# Per entity
7878
if isinstance(data.x, pd.DataFrame):
@@ -92,7 +92,7 @@ def test_valid_weight_shape(data):
9292
expected = expected.T.ravel()
9393
expected = expected[~missing.squeeze()][:, None]
9494
expected = expected / expected.mean()
95-
assert_equal(w, expected)
95+
assert w == pytest.approx(expected)
9696

9797
weights = 1 + np.random.random_sample(data.y.shape)
9898
mod = PanelOLS(data.y, data.x, weights=weights)
@@ -101,7 +101,7 @@ def test_valid_weight_shape(data):
101101
expected = weights.T.ravel()
102102
expected = expected[~missing.squeeze()][:, None]
103103
expected = expected / expected.mean()
104-
assert_equal(w, expected)
104+
assert w == pytest.approx(expected)
105105

106106

107107
def test_weight_incorrect_shape(data):

0 commit comments

Comments
 (0)