]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Factor out common attributes to pacify LSP checker
authorLele Gaifax <lele@metapensiero.it>
Wed, 9 Nov 2022 08:17:40 +0000 (09:17 +0100)
committerLele Gaifax <lele@metapensiero.it>
Wed, 9 Nov 2022 08:17:40 +0000 (09:17 +0100)
test/dialect/postgresql/test_types.py

index c10e06d45e6f53ffc279d25ff698761a9a4dff38..58c8efe916427a5cc3386c3c6233b26445821379 100644 (file)
@@ -3670,7 +3670,28 @@ class HStoreRoundTripTest(fixtures.TablesTest):
             eq_(s.query(Data.data, Data).all(), [(d.data, d)])
 
 
-class _RangeTypeCompilation(AssertsCompiledSQL, fixtures.TestBase):
+class _RangeTests:
+    _col_type = None
+    "The concrete range class these tests are for."
+
+    _col_str = None
+    "The corresponding PG type name."
+
+    _epsilon = None
+    """A small value used to generate range variants"""
+
+    def _data_str(self):
+        """return string form of a sample range"""
+        raise NotImplementedError()
+
+    def _data_obj(self):
+        """return Range form of the same range"""
+        raise NotImplementedError()
+
+
+class _RangeTypeCompilation(
+    AssertsCompiledSQL, _RangeTests, fixtures.TestBase
+):
     __dialect__ = "postgresql"
 
     # operator tests
@@ -3863,15 +3884,7 @@ class _RangeTypeCompilation(AssertsCompiledSQL, fixtures.TestBase):
         )
 
 
-class _RangeComparisonFixtures:
-    def _data_str(self):
-        """return string form of a sample range"""
-        raise NotImplementedError()
-
-    def _data_obj(self):
-        """return Range form of the same range"""
-        raise NotImplementedError()
-
+class _RangeComparisonFixtures(_RangeTests):
     def _step_value_up(self, value):
         """given a value, return a step up