Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit ed1dfda

Browse files
committed
Added tests for case-aware mapping
1 parent a637a18 commit ed1dfda

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_diff_tables.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,25 @@ def test_table_segment(self):
521521

522522
self.assertRaises(ValueError, self.table.replace, min_key=10, max_key=0)
523523

524+
def test_case_awareness(self):
525+
# create table
526+
self.connection.query(f"create table {self.table_src}(id int, userid int, timestamp timestamp)", None)
527+
_commit(self.connection)
528+
529+
# insert rows
530+
cols = "id userid timestamp".split()
531+
time = "2022-01-01 00:00:00.000000"
532+
time_str = f"timestamp '{time}'"
533+
_insert_rows(self.connection, self.table_src, cols, [[1, 9, time_str], [2, 2, time_str]])
534+
_commit(self.connection)
535+
536+
res = tuple(self.table.replace(key_column="Id", case_sensitive=False).with_schema().query_key_range())
537+
assert res == ("1", "2")
538+
539+
self.assertRaises(
540+
KeyError, self.table.replace(key_column="Id", case_sensitive=True).with_schema().query_key_range
541+
)
542+
524543

525544
@test_per_database
526545
class TestTableUUID(TestPerDatabase):

0 commit comments

Comments
 (0)