Add a couple more tests

This commit is contained in:
Neil Booth 2016-11-14 07:43:08 +09:00
parent 0eb9e9731e
commit 6849937628

View File

@ -3,6 +3,9 @@ from lib import util
def test_cachedproperty():
class Target:
CALL_COUNT = 0
def __init__(self):
self.call_count = 0
@ -11,8 +14,15 @@ def test_cachedproperty():
self.call_count += 1
return self.call_count
@util.cachedproperty
def cls_prop(cls):
cls.CALL_COUNT += 1
return cls.CALL_COUNT
t = Target()
assert t.prop == t.prop == 1
assert Target.cls_prop == Target.cls_prop == 1
def test_deep_getsizeof():
@ -36,6 +46,7 @@ class B(Base):
def test_subclasses():
assert util.subclasses(Base) == [A, B]
assert util.subclasses(Base, strict=False) == [A, B, Base]
def test_chunks():