changed dummy class to a dummy class factory
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from unittest import TestCase
|
||||
from creational import singleton
|
||||
|
||||
from tests.utils.dummy_class import dummy_factory
|
||||
from patterns.creational import Singleton
|
||||
|
||||
|
||||
class SingletonTestCase(TestCase):
|
||||
@@ -9,6 +11,16 @@ class SingletonTestCase(TestCase):
|
||||
def setUp(self):
|
||||
"""
|
||||
Initialize testing data.
|
||||
|
||||
:return:
|
||||
"""
|
||||
self.dummy_class = dummy_factory(base_class=Singleton, attributes={}, functions={})
|
||||
|
||||
def test_id(self):
|
||||
"""
|
||||
Test the id's of two singleton instances.
|
||||
|
||||
@raise AssertionError: If the test fails.
|
||||
"""
|
||||
dummy = self.dummy_class()
|
||||
dummy_2 = self.dummy_class()
|
||||
|
||||
self.assertEquals(id(dummy), id(dummy_2))
|
||||
Reference in New Issue
Block a user