diff --git a/quaddtype/tests/test_quaddtype.py b/quaddtype/tests/test_quaddtype.py index 79613d3..375c0c9 100644 --- a/quaddtype/tests/test_quaddtype.py +++ b/quaddtype/tests/test_quaddtype.py @@ -3095,4 +3095,14 @@ def test_buffer(): buff = a.data reconstructed = np.frombuffer(buff, dtype=QuadPrecDType())[0] - assert reconstructed == a, "Buffer reconstruction failed" \ No newline at end of file + 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" \ No newline at end of file