diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2021-03-07 17:54:57 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2021-03-07 17:54:57 (GMT) |
commit | fde9e3b46192a065ec622da1395c48015df3cf32 (patch) | |
tree | c149b6836fd38d125f0630332577990f088560d8 /tests | |
parent | 7a60504691ebd8b914592e60990cc3526cf26e29 (diff) |
Handle hashes of data types as Py_ssize_t values from Python bindings.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/analysis/type.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/analysis/type.py b/tests/analysis/type.py index b690a55..405659e 100644 --- a/tests/analysis/type.py +++ b/tests/analysis/type.py @@ -107,3 +107,18 @@ class TestDataType(ChrysalideTestCase): tp = MyUserType('random') self.assertEqual(tp.hash, hash('random') & ((1 << 32) - 1)) + + class MyOutOfRangeUserType(DataType): + + hard_coded_hash = -8752470794866657507 + + def __init__(self, name): + super(MyOutOfRangeUserType, self).__init__() + self._name = name + + def _hash(self): + return self.hard_coded_hash + + tp = MyOutOfRangeUserType('out-of-range') + + self.assertEqual(tp.hash, MyOutOfRangeUserType.hard_coded_hash & ((1 << 32) - 1)) |