diff --git a/src/infi/clickhouse_orm/funcs.py b/src/infi/clickhouse_orm/funcs.py index f137a45..39dc871 100644 --- a/src/infi/clickhouse_orm/funcs.py +++ b/src/infi/clickhouse_orm/funcs.py @@ -431,7 +431,7 @@ class F(Cond, FunctionOperatorsMixin, metaclass=FMeta): @staticmethod def toQuarter(d, timezone=''): - return F('toQuarter', d, timezone) + return F('toQuarter', d, timezone) if timezone else F('toQuarter', d) @staticmethod def toMonth(d): diff --git a/tests/test_compressed_fields.py b/tests/test_compressed_fields.py index 3de5d22..3c8282e 100644 --- a/tests/test_compressed_fields.py +++ b/tests/test_compressed_fields.py @@ -89,8 +89,9 @@ class CompressedFieldsTestCase(unittest.TestCase): "datetime_field": datetime.datetime(1970, 1, 1, 0, 0, 0, tzinfo=pytz.utc) }) - # This test will fail on clickhouse version < 19.1.16, use skip test def test_confirm_compression_codec(self): + if self.database.server_version < (19, 17): + raise unittest.SkipTest('ClickHouse version too old') instance = CompressedModel(date_field='1973-12-06', int64_field='100', float_field='7', array_field='[a,b,c]') self.database.insert([instance]) r = self.database.raw("select name, compression_codec from system.columns where table = '{}' and database='{}' FORMAT TabSeparatedWithNamesAndTypes".format(instance.table_name(), self.database.db_name)) diff --git a/tests/test_ip_fields.py b/tests/test_ip_fields.py index 448afc8..f829db2 100644 --- a/tests/test_ip_fields.py +++ b/tests/test_ip_fields.py @@ -16,6 +16,8 @@ class IPFieldsTest(unittest.TestCase): self.database.drop_database() def test_ipv4_field(self): + if self.database.server_version < (19, 17): + raise unittest.SkipTest('ClickHouse version too old') # Create a model class TestModel(Model): i = Int16Field() @@ -40,6 +42,8 @@ class IPFieldsTest(unittest.TestCase): TestModel(i=1, f=value) def test_ipv6_field(self): + if self.database.server_version < (19, 17): + raise unittest.SkipTest('ClickHouse version too old') # Create a model class TestModel(Model): i = Int16Field() diff --git a/tests/test_querysets.py b/tests/test_querysets.py index bca8076..cec4616 100644 --- a/tests/test_querysets.py +++ b/tests/test_querysets.py @@ -471,6 +471,8 @@ class AggregateTestCase(TestCaseWithData): self.assertEqual(qs.conditions_as_sql(), 'the__next__number > 1') def test_limit_by(self): + if self.database.server_version < (19, 17): + raise unittest.SkipTest('ClickHouse version too old') # Test without offset qs = Person.objects_in(self.database).aggregate('first_name', 'last_name', 'height', n='count()').\ order_by('first_name', '-height').limit_by(1, 'first_name')