dotfiles/dotfiles/lib/python/singleton_test.py

16 lines
312 B
Python
Raw Normal View History

2015-08-20 02:11:55 -07:00
from . import singleton
def test_singleton():
@singleton.singleton
class TestSingleton(object):
def __init__(self):
self.a = 22
self.b = 44
def hey(self):
return self.a + self.b
assert TestSingleton.a == 22
assert TestSingleton.hey() == 66