Last active
August 29, 2015 14:16
-
-
Save mambocab/364ef25f82d8eed63a2e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def nan_infinity_test(self): | |
cursor = self.prepare() | |
cursor.execute("CREATE TABLE test (f float PRIMARY KEY)") | |
cursor.execute("INSERT INTO test(f) VALUES (NaN)") | |
cursor.execute("INSERT INTO test(f) VALUES (-NaN)") | |
cursor.execute("INSERT INTO test(f) VALUES (Infinity)") | |
cursor.execute("INSERT INTO test(f) VALUES (-Infinity)") | |
assert_all(cursor, "SELECT * FROM test", | |
[[float("nan")], [float("inf")], [float("-inf")]]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-> assert list_res == expected, "Expected %s from %s, but got %s" % (expected, query, list_res) | |
(Pdb) list_res | |
[[nan], [inf], [-inf]] | |
(Pdb) list_res[0][0] | |
nan | |
(Pdb) list_res[0][0] | |
nan | |
(Pdb) expected[0][0] | |
nan | |
(Pdb) list_res[0][0] == expected[0][0] | |
False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> float('nan') == float('nan') | |
False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment