Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion quaddtype/tests/test_quaddtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -3095,4 +3095,14 @@ def test_buffer():
buff = a.data

reconstructed = np.frombuffer(buff, dtype=QuadPrecDType())[0]
assert reconstructed == a, "Buffer reconstruction failed"
assert reconstructed == a, "Buffer reconstruction failed"

@pytest.mark.parametrize("value", [0.0, -0.0, 1.0, -1.0, 3.14, -2.71, "inf", "-inf", "nan"])
def test_imag_real(value):
a = QuadPrecision(value)
if np.isnan(a):
assert np.isnan(a.real), "Real part of NaN should be NaN"
assert a.imag == QuadPrecision(0.0), "Imaginary part should be zero"
return
assert a.real == a, "Real part mismatch"
assert a.imag == QuadPrecision(0.0), "Imaginary part should be zero"