diff --git a/test_future.py b/test_future.py index 622b050f..e0562569 100644 --- a/test_future.py +++ b/test_future.py @@ -32,23 +32,3 @@ def test_serialize_time_with_micros(cur): cur.execute('SELECT a FROM t') assert cur.fetchone()[0] != datetime.time(15, 19, 10, 12) # This should be equal assert cur.fetchone() is None - -def test_serialize_decimal_large(cur): - cur.execute('DROP TABLE IF EXISTS t') - cur.execute('CREATE TABLE t(i INTEGER NOT NULL, a DECIMAL(1) NOT NULL, PRIMARY KEY(i))') - with pytest.raises(polypheny.Error, match='RuntimeException'): - cur.execute('INSERT INTO t(i, a) VALUES (0, ?)', (2**77,)) - - return # remove if execute works - cur.execute('SELECT a FROM t') - assert cur.fetchone()[0] == 2**77 - assert cur.fetchone() is None - -def test_serialize_decimal_large2(cur): - cur.execute('DROP TABLE IF EXISTS t') - cur.execute('CREATE TABLE t(i INTEGER NOT NULL, a DECIMAL NOT NULL, PRIMARY KEY(i))') - cur.execute('INSERT INTO t(i, a) VALUES (0, ?)', (2**77,)) - cur.execute('SELECT a FROM t') - - assert cur.fetchone()[0] == 151115727451828650000000 # This should be 2**77 or 151115727451828646838272 - assert cur.fetchone() is None diff --git a/test_serialize.py b/test_serialize.py index 9d6b4373..ce85e414 100644 --- a/test_serialize.py +++ b/test_serialize.py @@ -144,6 +144,25 @@ def test_serialize_list(cur): assert cur.fetchone()[0] == [1, 2, 3] assert cur.fetchone() is None +def test_serialize_decimal_large(cur): + cur.execute('DROP TABLE IF EXISTS t') + cur.execute('CREATE TABLE t(i INTEGER NOT NULL, a DECIMAL(1) NOT NULL, PRIMARY KEY(i))') + cur.execute('INSERT INTO t(i, a) VALUES (0, ?)', (2**77,)) + + cur.execute('SELECT a FROM t') + assert cur.fetchone()[0] == 2**77 + assert cur.fetchone() is None + +def test_serialize_decimal_large2(cur): + cur.execute('DROP TABLE IF EXISTS t') + cur.execute('CREATE TABLE t(i INTEGER NOT NULL, a DECIMAL NOT NULL, PRIMARY KEY(i))') + cur.execute('INSERT INTO t(i, a) VALUES (0, ?)', (2**77,)) + cur.execute('SELECT a FROM t') + + assert cur.fetchone()[0] == 151115727451828646838272 + assert cur.fetchone() is None + + def test_deserialize_number(cur): cur.execute('SELECT 1') assert cur.fetchone()[0] == 1