Skip to content

Commit b294656

Browse files
committed
Assert something about the output of function calls in test_blas.py
1 parent be6a1fb commit b294656

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

tests/tensor/test_blas.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,45 +1901,42 @@ def test_outer(self):
19011901
rng = np.random.default_rng(unittest_tools.fetch_seed())
19021902
f = self.function([self.x, self.y], outer(self.x, self.y))
19031903
self.assertFunctionContains(f, self.ger_destructive)
1904-
# TODO FIXME: This is NOT a test.
19051904
f(
19061905
rng.random((5)).astype(self.dtype),
19071906
rng.random((4)).astype(self.dtype),
1908-
)
1907+
).shape == (5, 4)
19091908

19101909
def test_A_plus_outer(self):
19111910
rng = np.random.default_rng(unittest_tools.fetch_seed())
19121911
f = self.function([self.A, self.x, self.y], self.A + outer(self.x, self.y))
19131912
self.assertFunctionContains(f, self.ger)
1914-
# TODO FIXME: This is NOT a test.
19151913
f(
19161914
rng.random((5, 4)).astype(self.dtype),
19171915
rng.random((5)).astype(self.dtype),
19181916
rng.random((4)).astype(self.dtype),
1919-
)
1917+
).shape == (5, 4)
19201918
f(
19211919
rng.random((5, 4)).astype(self.dtype)[::-1, ::-1],
19221920
rng.random((5)).astype(self.dtype),
19231921
rng.random((4)).astype(self.dtype),
1924-
)
1922+
).shape == (5, 4)
19251923

19261924
def test_A_plus_scaled_outer(self):
19271925
rng = np.random.default_rng(unittest_tools.fetch_seed())
19281926
f = self.function(
19291927
[self.A, self.x, self.y], self.A + 0.1 * outer(self.x, self.y)
19301928
)
19311929
self.assertFunctionContains(f, self.ger)
1932-
# TODO FIXME: This is NOT a test.
19331930
f(
19341931
rng.random((5, 4)).astype(self.dtype),
19351932
rng.random((5)).astype(self.dtype),
19361933
rng.random((4)).astype(self.dtype),
1937-
)
1934+
).shape == (5, 4)
19381935
f(
19391936
rng.random((5, 4)).astype(self.dtype)[::-1, ::-1],
19401937
rng.random((5)).astype(self.dtype),
19411938
rng.random((4)).astype(self.dtype),
1942-
)
1939+
).shape == (5, 4)
19431940

19441941
def test_scaled_A_plus_scaled_outer(self):
19451942
rng = np.random.default_rng(unittest_tools.fetch_seed())
@@ -1951,17 +1948,16 @@ def test_scaled_A_plus_scaled_outer(self):
19511948
# Why gemm? This make the graph simpler did we test that it
19521949
# make it faster?
19531950
self.assertFunctionContains(f, self.gemm)
1954-
# TODO FIXME: This is NOT a test.
19551951
f(
19561952
rng.random((5, 4)).astype(self.dtype),
19571953
rng.random((5)).astype(self.dtype),
19581954
rng.random((4)).astype(self.dtype),
1959-
)
1955+
).shape == (5, 4)
19601956
f(
19611957
rng.random((5, 4)).astype(self.dtype)[::-1, ::-1],
19621958
rng.random((5)).astype(self.dtype),
19631959
rng.random((4)).astype(self.dtype),
1964-
)
1960+
).shape == (5, 4)
19651961

19661962
def given_dtype(self, dtype, M, N):
19671963
# test corner case shape and dtype
@@ -1971,17 +1967,16 @@ def given_dtype(self, dtype, M, N):
19711967
[self.A, self.x, self.y], self.A + 0.1 * outer(self.x, self.y)
19721968
)
19731969
self.assertFunctionContains(f, self.ger)
1974-
# TODO FIXME: This is NOT a test.
19751970
f(
19761971
rng.random((M, N)).astype(self.dtype),
19771972
rng.random((M)).astype(self.dtype),
19781973
rng.random((N)).astype(self.dtype),
1979-
)
1974+
).shape == (5, 4)
19801975
f(
19811976
rng.random((M, N)).astype(self.dtype)[::-1, ::-1],
19821977
rng.random((M)).astype(self.dtype),
19831978
rng.random((N)).astype(self.dtype),
1984-
)
1979+
).shape == (5, 4)
19851980

19861981
def test_f32_0_0(self):
19871982
return self.given_dtype("float32", 0, 0)
@@ -2024,7 +2019,7 @@ def test_inplace(self):
20242019
],
20252020
)
20262021
self.assertFunctionContains(f, self.ger_destructive)
2027-
# TODO FIXME: This is NOT a test.
2022+
# TODO: Test something about the updated value of `A`
20282023
f(
20292024
rng.random((4)).astype(self.dtype),
20302025
rng.random((5)).astype(self.dtype),

0 commit comments

Comments
 (0)