|
9 | 9 | from sqeleton.queries import table, current_timestamp, NormalizeAsString |
10 | 10 | from .common import TEST_MYSQL_CONN_STRING |
11 | 11 | from .common import str_to_checksum, test_each_database_in_list, get_conn, random_table_suffix |
| 12 | +from sqeleton.abcs.database_types import TimestampTZ |
12 | 13 |
|
13 | 14 | TEST_DATABASES = { |
14 | 15 | dbs.MySQL, |
@@ -83,22 +84,22 @@ def test_current_timestamp(self): |
83 | 84 | def test_correct_timezone(self): |
84 | 85 | name = "tbl_" + random_table_suffix() |
85 | 86 | db = get_conn(self.db_cls) |
86 | | - tbl = table(db.parse_table_name(name), schema={ |
87 | | - "id": int, "created_at": "timestamp_tz(9)", "updated_at": "timestamp_tz(9)" |
| 87 | + tbl = table(name, schema={ |
| 88 | + "id": int, "created_at": TimestampTZ(9), "updated_at": TimestampTZ(9) |
88 | 89 | }) |
89 | 90 |
|
90 | 91 | db.query(tbl.create()) |
91 | 92 |
|
92 | 93 | tz = pytz.timezone('Europe/Berlin') |
93 | 94 |
|
94 | 95 | now = datetime.now(tz) |
95 | | - db.query(table(db.parse_table_name(name)).insert_row("1", now, now)) |
| 96 | + db.query(table(name).insert_row("1", now, now)) |
96 | 97 | db.query(db.dialect.set_timezone_to_utc()) |
97 | 98 |
|
98 | 99 | t = db.table(name).query_schema() |
99 | | - t.schema["created_at"] = t.schema["created_at"].replace(precision=t.schema["created_at"].precision, rounds=True) |
| 100 | + t.schema["created_at"] = t.schema["created_at"].replace(precision=t.schema["created_at"].precision) |
100 | 101 |
|
101 | | - tbl = table(db.parse_table_name(name), schema=t.schema) |
| 102 | + tbl = table(name, schema=t.schema) |
102 | 103 |
|
103 | 104 | results = db.query(tbl.select(NormalizeAsString(tbl[c]) for c in ["created_at", "updated_at"]), List[Tuple]) |
104 | 105 |
|
|
0 commit comments