Skip to content

Commit cb6144a

Browse files
fixing duration class and adding a testing file for it
1 parent 08e784e commit cb6144a

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

src/surrealdb/cbor2/_encoder.py

-1
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,6 @@ def encode_boolean(self, value: bool) -> None:
657657
self._fp_write(b"\xf5" if value else b"\xf4")
658658

659659
def encode_none(self, value: None) -> None:
660-
print("encoding None")
661660
# tag(6, None)
662661
self._fp_write(b"\xd9\x00\x06\xf6")
663662
# self._fp_write(b"\xf6")

src/surrealdb/data/cbor.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,10 @@ def default_encoder(encoder, obj):
3535
tagged = CBORTag(constants.TAG_GEOMETRY_MULTI_LINE, obj.get_coordinates())
3636

3737
elif isinstance(obj, GeometryMultiPoint):
38-
tagged = CBORTag(
39-
constants.TAG_GEOMETRY_MULTI_POINT, obj.get_coordinates()
40-
)
38+
tagged = CBORTag(constants.TAG_GEOMETRY_MULTI_POINT, obj.get_coordinates())
4139

4240
elif isinstance(obj, GeometryMultiPolygon):
43-
tagged = CBORTag(
44-
constants.TAG_GEOMETRY_MULTI_POLYGON, obj.get_coordinates()
45-
)
41+
tagged = CBORTag(constants.TAG_GEOMETRY_MULTI_POLYGON, obj.get_coordinates())
4642

4743
elif isinstance(obj, GeometryCollection):
4844
tagged = CBORTag(constants.TAG_GEOMETRY_COLLECTION, obj.geometries)

tests/unit_tests/data_types/test_duration.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ def test_properties(self):
5858

5959
def test_to_string(self):
6060
d = Duration.parse("90m") # 90 minutes = 1 hour 30 min
61-
# The largest integer-based unit is 1 hour so the method returns "1h"
62-
self.assertEqual(d.to_string(), "1h")
61+
self.assertEqual("90m", d.to_string())
6362

6463
def test_to_compact(self):
6564
d = Duration.parse(60) # 60 seconds

0 commit comments

Comments
 (0)