summaryrefslogtreecommitdiff
path: root/tests/test_gi.py
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-03-31 23:41:16 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2018-03-31 23:41:16 +0200
commit78f5cc159afb76d35b703bd6f3d1adcdc96bdd8a (patch)
treec79d4daafaadb51d42c6da724a86dea239afd920 /tests/test_gi.py
parentcbb64dd73ca7114ee423caa5e5dcc58a2de87126 (diff)
downloadpygobject-78f5cc159afb76d35b703bd6f3d1adcdc96bdd8a.tar.gz
enum/flags: set tp_hash on Python 2 as well; add hash() tests
It shouldn't make a difference.
Diffstat (limited to 'tests/test_gi.py')
-rw-r--r--tests/test_gi.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 24d94b20..4d65e803 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -1814,6 +1814,10 @@ class TestEnum(unittest.TestCase):
self.assertEqual(GIMarshallingTests.Enum.__module__,
"gi.repository.GIMarshallingTests")
+ def test_hash(self):
+ assert (hash(GIMarshallingTests.Enum.VALUE1) ==
+ hash(GIMarshallingTests.Enum(GIMarshallingTests.Enum.VALUE1)))
+
def test_repr(self):
self.assertEqual(repr(GIMarshallingTests.Enum.VALUE3),
"<enum GI_MARSHALLING_TESTS_ENUM_VALUE3 of type "
@@ -1890,6 +1894,10 @@ class TestGEnum(unittest.TestCase):
self.assertEqual(GIMarshallingTests.GEnum.__module__,
"gi.repository.GIMarshallingTests")
+ def test_hash(self):
+ assert (hash(GIMarshallingTests.GEnum.VALUE3) ==
+ hash(GIMarshallingTests.GEnum(GIMarshallingTests.GEnum.VALUE3)))
+
def test_repr(self):
self.assertEqual(repr(GIMarshallingTests.GEnum.VALUE3),
"<enum GI_MARSHALLING_TESTS_GENUM_VALUE3 of type "
@@ -1958,6 +1966,10 @@ class TestGFlags(unittest.TestCase):
"<flags GI_MARSHALLING_TESTS_FLAGS_VALUE2 of type "
"GIMarshallingTests.Flags>")
+ def test_hash(self):
+ assert (hash(GIMarshallingTests.Flags.VALUE2) ==
+ hash(GIMarshallingTests.Flags(GIMarshallingTests.Flags.VALUE2)))
+
def test_flags_large_in(self):
GIMarshallingTests.extra_flags_large_in(
GIMarshallingTests.ExtraFlags.VALUE2)