def test_nan_complex(): nan1 = complex(0, float("nan")) nan2 = complex(0, float("nan")) assert_if_not_on_PYPY(nan1 is not nan2, reason="nan is singelton in PyPy") s = PyObjectSet() s.add(nan1) assert nan2 in s
def test_nan_in_tuple(): nan1 = (float("nan"),) nan2 = (float("nan"),) assert_if_not_on_PYPY(nan1[0] is not nan2[0], reason="nan is singelton in PyPy") s = PyObjectSet() s.add(nan1) assert nan2 in s
def test_nan_complex(): nan1 = complex(0, float("nan")) nan2 = complex(0, float("nan")) assert_if_not_on_PYPY(nan1 is not nan2, reason="nan is singelton in PyPy") table = PyObjectMap() table[nan1] = 42 assert table[nan2] == 42
def test_nan_in_tuple(): nan1 = (float("nan"), ) nan2 = (float("nan"), ) assert_if_not_on_PYPY(nan1[0] is not nan2[0], reason="nan is singelton in PyPy") table = PyObjectMap() table[nan1] = 42 assert table[nan2] == 42
def test_equal_tupples_with_nan(self): t1 = (1, (float("nan"), 2), (4, (float("nan"), ))) t2 = (1, (float("nan"), 2), (4, (float("nan"), ))) assert_if_not_on_PYPY(t1 != t2, "nan is a singleton on PyPy") assert objects_are_equal(t1, t2)