From 71cdbd8f8067c611b97bad7e93f795593df63c8c Mon Sep 17 00:00:00 2001 From: Dmitrii Kovalkov Date: Thu, 30 Mar 2023 08:49:50 +0300 Subject: [PATCH] Fix tests --- src/infi/clickhouse_orm/models.py | 5 ++++- tests/test_database.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/infi/clickhouse_orm/models.py b/src/infi/clickhouse_orm/models.py index e3f95e3..4335b4e 100644 --- a/src/infi/clickhouse_orm/models.py +++ b/src/infi/clickhouse_orm/models.py @@ -224,7 +224,10 @@ class ModelBase(type): # Tuples (poor man's version - convert to array) if db_type.startswith('Tuple'): types = [s.strip() for s in db_type[6 : -1].split(',')] - assert len(set(types)) == 1, 'No support for mixed types in tuples - ' + db_type + if len(types[0].split()) != 1: + raise NotImplementedError('No support for named tuples - %s' % db_type) + if len(set(types)) != 1: + raise NotImplementedError('No support for mixed types in tuples - %s' % db_type) inner_field = cls.create_ad_hoc_field(types[0]) return orm_fields.ArrayField(inner_field) # FixedString diff --git a/tests/test_database.py b/tests/test_database.py index 44971e1..bf70d47 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -254,6 +254,8 @@ class DatabaseTestCase(TestCaseWithData): for row in self.database.select(query): if row.type.startswith('Map'): continue # Not supported yet + if 'Tuple' in row.type: + continue # Not fully supported yet ModelBase.create_ad_hoc_field(row.type) def test_get_model_for_table(self):