Commit de135bab authored by Lukáš Lalinský's avatar Lukáš Lalinský

Disable some tests when running on Phoenix 4.4

parent 18058375
......@@ -20,11 +20,12 @@ class TypesTest(DatabaseTestCase):
cursor.execute("SELECT id, val FROM phoenixdb_test_tbl1 ORDER BY id")
self.assertEqual(cursor.description[1].type_code, phoenixdb.NUMBER)
self.assertEqual(cursor.fetchall(), [[1, 1], [2, None], [3, 1], [4, None], [5, min_value], [6, max_value]])
self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, {})".format(min_value - 1))
self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, {})".format(max_value + 1))
# XXX The server silently truncates the values
#self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, ?)", [min_value - 1])
#self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, ?)", [max_value + 1])
if self.conn._client.version >= AVATICA_1_4_0:
self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, {})".format(min_value - 1))
self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, {})".format(max_value + 1))
# XXX The server silently truncates the values
#self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, ?)", [min_value - 1])
#self.assertRaises(self.conn.DatabaseError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, ?)", [max_value + 1])
def test_integer(self):
self.checkIntType("integer", -2147483648, 2147483647)
......@@ -39,9 +40,13 @@ class TypesTest(DatabaseTestCase):
self.checkIntType("unsigned_long", 0, 9223372036854775807)
def test_tinyint(self):
if self.conn._client.version < AVATICA_1_4_0:
raise unittest.SkipTest('tinyint only work properly with calcite >= 1.4.0')
self.checkIntType("tinyint", -128, 127)
def test_unsigned_tinyint(self):
if self.conn._client.version < AVATICA_1_4_0:
raise unittest.SkipTest('tinyint only work properly with calcite >= 1.4.0')
self.checkIntType("unsigned_tinyint", 0, 127)
def test_smallint(self):
......@@ -116,7 +121,8 @@ class TypesTest(DatabaseTestCase):
self.assertEqual(cursor.fetchall(), [[1, True], [2, False], [3, None], [4, True], [5, False], [6, None]])
def test_time(self):
# XXX We should be able to read/write full date with time, not just time
if self.conn._client.version < AVATICA_1_4_0:
raise unittest.SkipTest('date/time/timestamp only works with Calcite >= 1.4.0')
self.createTable("phoenixdb_test_tbl1", "id integer primary key, val time")
with self.conn.cursor() as cursor:
cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, '1970-01-01 12:01:02')")
......@@ -146,6 +152,8 @@ class TypesTest(DatabaseTestCase):
])
def test_date(self):
if self.conn._client.version < AVATICA_1_4_0:
raise unittest.SkipTest('date/time/timestamp only works with Calcite >= 1.4.0')
self.createTable("phoenixdb_test_tbl1", "id integer primary key, val date")
with self.conn.cursor() as cursor:
cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, '2015-07-12 00:00:00')")
......@@ -183,6 +191,8 @@ class TypesTest(DatabaseTestCase):
])
def test_timestamp(self):
if self.conn._client.version < AVATICA_1_4_0:
raise unittest.SkipTest('date/time/timestamp only works with Calcite >= 1.4.0')
self.createTable("phoenixdb_test_tbl1", "id integer primary key, val timestamp")
with self.conn.cursor() as cursor:
cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, '2015-07-12 13:01:02.123')")
......@@ -222,6 +232,8 @@ class TypesTest(DatabaseTestCase):
self.assertEqual(cursor.fetchall(), [[1, 'abc'], [2, None], [3, 'abc'], [4, None], [5, None], [6, None]])
def test_varchar_very_long(self):
if self.conn._client.version < AVATICA_1_4_0:
raise unittest.SkipTest('long requests only work with Calcite >= 1.4.0')
self.createTable("phoenixdb_test_tbl1", "id integer primary key, val varchar")
with self.conn.cursor() as cursor:
value = '1234567890' * 1000
......@@ -266,6 +278,8 @@ class TypesTest(DatabaseTestCase):
self.assertRaises(self.conn.DataError, cursor.execute, "UPSERT INTO phoenixdb_test_tbl1 VALUES (100, 'abc')")
def test_binary(self):
if self.conn._client.version < AVATICA_1_4_0:
raise unittest.SkipTest('binary strings only work with Calcite >= 1.4.0')
self.createTable("phoenixdb_test_tbl1", "id integer primary key, val binary(2)")
with self.conn.cursor() as cursor:
cursor.execute("UPSERT INTO phoenixdb_test_tbl1 VALUES (1, 'ab')")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment