b0a5305b94dde384cd664a0223300857bc9987d1
[platform/upstream/python-gobject.git] / tests / test_overrides.py
1 # -*- Mode: Python; py-indent-offset: 4 -*-
2 # vim: tabstop=4 shiftwidth=4 expandtab
3
4 import unittest
5
6 import gi.overrides
7 from gi.repository import Regress
8
9
10 class TestRegistry(unittest.TestCase):
11     def test_non_gi(self):
12         class MyClass:
13             pass
14
15         try:
16             gi.overrides.override(MyClass)
17             self.fail('unexpected success of overriding non-GI class')
18         except TypeError as e:
19             self.assertTrue('Can not override a type MyClass' in str(e))
20
21     def test_separate_path(self):
22         # Regress override is in tests/gi/overrides, separate from gi/overrides
23         # https://bugzilla.gnome.org/show_bug.cgi?id=680913
24         self.assertEqual(Regress.REGRESS_OVERRIDE, 42)