]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Add Range.bounds attribute
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 9 Jun 2021 15:43:05 +0000 (16:43 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 25 Jun 2021 15:16:26 +0000 (16:16 +0100)
psycopg3/psycopg3/types/range.py
tests/types/test_range.py

index 0ebecbd55bafc344ea0914a7291c4cd53b7d4034..bbc5c1e5da53f4496d31f6776dbd132aa75c1df9 100644 (file)
@@ -92,6 +92,11 @@ class Range(Generic[T]):
         """The upper bound of the range. `!None` if empty or unbound."""
         return self._upper
 
+    @property
+    def bounds(self) -> str:
+        """The bounds string (two characters from '[', '(', ']', ')')."""
+        return self._bounds
+
     @property
     def isempty(self) -> bool:
         """`!True` if the range is empty."""
index b8e1617464192353ca07b61c2dca01c91d8bc8c3..285d02a6278016bc219cc1e3367f0d7eaacd6723 100644 (file)
@@ -289,6 +289,7 @@ class TestRangeObject:
             ("[]", True, True),
         ]:
             r = Range(10, 20, bounds)
+            assert r.bounds == bounds
             assert r.lower == 10
             assert r.upper == 20
             assert not r.isempty