Skip to content

Commit ee98269

Browse files
committed
testS
1 parent 5857a7d commit ee98269

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

quaddtype/tests/test_quaddtype.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,3 +1693,25 @@ def test_heaviside_broadcast():
16931693
assert result.dtype.name == "QuadPrecDType128"
16941694
np.testing.assert_array_equal(result.astype(float), expected)
16951695

1696+
1697+
@pytest.mark.parametrize("func", [np.conj, np.conjugate])
1698+
@pytest.mark.parametrize("value", [
1699+
0.0,
1700+
-0.0,
1701+
1.5,
1702+
-1.5,
1703+
np.inf,
1704+
-np.inf,
1705+
np.nan,
1706+
])
1707+
def test_conj_conjugate_identity(func, value):
1708+
"""Test that conj and conjugate are identity (no-op) for real quad precision numbers"""
1709+
x = QuadPrecision(value)
1710+
result = func(x)
1711+
1712+
# For NaN, use special comparison
1713+
if np.isnan(value):
1714+
assert np.isnan(float(result))
1715+
else:
1716+
assert result == x
1717+

0 commit comments

Comments
 (0)