| 1 |
from unittest import TestCase |
| 2 |
|
| 3 |
from gi.repository.GObject import GObject |
| 4 |
|
| 5 |
from blueman.gobject import SingletonGObjectMeta |
| 6 |
|
| 7 |
|
| 8 |
class TestGObjectMeta(TestCase): |
| 9 |
class A(GObject, metaclass=SingletonGObjectMeta): |
| 10 |
pass |
| 11 |
|
| 12 |
class B(GObject, metaclass=SingletonGObjectMeta): |
| 13 |
pass |
| 14 |
|
| 15 |
def test_instantiation(self): |
| 16 |
self.assertIsInstance(self.A(), GObject) |
| 17 |
|
| 18 |
def test_singleton(self): |
| 19 |
self.assertEqual(self.A(), self.A()) |
| 20 |
|
| 21 |
def test_separation(self): |
| 22 |
self.assertNotEqual(self.A(), self.B()) |