cleaned up warnings
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
class Singleton(type):
|
class Singleton(type):
|
||||||
"""
|
"""
|
||||||
Singleton Metaclass.
|
Singleton Metaclass.
|
||||||
@@ -16,4 +14,3 @@ class Singleton(type):
|
|||||||
cls.__instance = type.__call__(cls, *args, **kwargs)
|
cls.__instance = type.__call__(cls, *args, **kwargs)
|
||||||
|
|
||||||
return cls.__instance
|
return cls.__instance
|
||||||
|
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from pypatterns.creational_patterns import Singleton
|
||||||
from tests.utils.dummy import dummy_class_factory
|
from tests.utils.dummy import dummy_class_factory
|
||||||
from patterns.creational import Singleton
|
|
||||||
|
|
||||||
|
|
||||||
class SingletonTestCase(TestCase):
|
class SingletonTestCase(TestCase):
|
||||||
"""
|
"""
|
||||||
Unit testing class for the singleton design pattern.
|
Unit testing class for the singleton design pattern.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""
|
"""
|
||||||
Initialize testing data.
|
Initialize testing data.
|
||||||
@@ -48,4 +49,3 @@ class SingletonTestCase(TestCase):
|
|||||||
|
|
||||||
self.assertNotEquals(id(dummy_class_one_instance_one), id(dummy_class_two_instance_one))
|
self.assertNotEquals(id(dummy_class_one_instance_one), id(dummy_class_two_instance_one))
|
||||||
self.assertNotEquals(id(dummy_class_one_instance_two), id(dummy_class_two_instance_two))
|
self.assertNotEquals(id(dummy_class_one_instance_two), id(dummy_class_two_instance_two))
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
from unittest import TestCase
|
|
||||||
from tests.utils.dummy import dummy_class_factory
|
|
||||||
from abc import ABCMeta, ABC
|
from abc import ABCMeta, ABC
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from tests.utils.dummy import dummy_class_factory
|
||||||
|
|
||||||
|
|
||||||
class DummyClassTestCase(TestCase):
|
class DummyClassTestCase(TestCase):
|
||||||
"""
|
"""
|
||||||
Unit testing class for the DummyClass class.
|
Unit testing class for the DummyClass class.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""
|
"""
|
||||||
Initialize testing data.
|
Initialize testing data.
|
||||||
@@ -113,7 +115,3 @@ class DummyClassTestCase(TestCase):
|
|||||||
base_class=ABC)
|
base_class=ABC)
|
||||||
|
|
||||||
self.assertEquals(ABC, dummy_class.__base__)
|
self.assertEquals(ABC, dummy_class.__base__)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ from types import MethodType
|
|||||||
|
|
||||||
|
|
||||||
def dummy_class_factory(attributes, functions, base_class=object, meta_class=type):
|
def dummy_class_factory(attributes, functions, base_class=object, meta_class=type):
|
||||||
|
|
||||||
class DummyClass(base_class, metaclass=meta_class):
|
class DummyClass(base_class, metaclass=meta_class):
|
||||||
"""
|
"""
|
||||||
Class representing dummy data.
|
Class representing dummy data.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user