Add a couple more tests
This commit is contained in:
parent
0eb9e9731e
commit
6849937628
@ -3,6 +3,9 @@ from lib import util
|
|||||||
|
|
||||||
def test_cachedproperty():
|
def test_cachedproperty():
|
||||||
class Target:
|
class Target:
|
||||||
|
|
||||||
|
CALL_COUNT = 0
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.call_count = 0
|
self.call_count = 0
|
||||||
|
|
||||||
@ -11,8 +14,15 @@ def test_cachedproperty():
|
|||||||
self.call_count += 1
|
self.call_count += 1
|
||||||
return self.call_count
|
return self.call_count
|
||||||
|
|
||||||
|
@util.cachedproperty
|
||||||
|
def cls_prop(cls):
|
||||||
|
cls.CALL_COUNT += 1
|
||||||
|
return cls.CALL_COUNT
|
||||||
|
|
||||||
|
|
||||||
t = Target()
|
t = Target()
|
||||||
assert t.prop == t.prop == 1
|
assert t.prop == t.prop == 1
|
||||||
|
assert Target.cls_prop == Target.cls_prop == 1
|
||||||
|
|
||||||
|
|
||||||
def test_deep_getsizeof():
|
def test_deep_getsizeof():
|
||||||
@ -36,6 +46,7 @@ class B(Base):
|
|||||||
|
|
||||||
def test_subclasses():
|
def test_subclasses():
|
||||||
assert util.subclasses(Base) == [A, B]
|
assert util.subclasses(Base) == [A, B]
|
||||||
|
assert util.subclasses(Base, strict=False) == [A, B, Base]
|
||||||
|
|
||||||
|
|
||||||
def test_chunks():
|
def test_chunks():
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user