Skip to content

Commit 4d4a4ec

Browse files
committed
Hyrums Law: annotations on instances
Should have been on the class.
1 parent 902b828 commit 4d4a4ec

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

apsw/tests/__main__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10647,7 +10647,11 @@ def testExtDataClassRowFactory(self) -> None:
1064710647
)
1064810648
self.assertEqual(dcrf.get_type("an integer"), int)
1064910649
for row in self.db.execute("select * from foo"):
10650-
a = row.__annotations__
10650+
self.assertTrue(dataclasses.is_dataclass(row))
10651+
if hasattr(inspect, "get_annotations"):
10652+
a= inspect.get_annotations(row.__class__)
10653+
else:
10654+
a = row.__class__.__annotations__
1065110655
self.assertEqual(a["one"], typing.Any)
1065210656
self.assertEqual(a["two"], int)
1065310657
self.assertEqual(a["three"], str)

0 commit comments

Comments
 (0)