Browse Source

Add a couple more tests

master
Neil Booth 8 years ago
parent
commit
6849937628
  1. 11
      tests/test_util.py

11
tests/test_util.py

@ -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():

Loading…
Cancel
Save