From 6849937628447250c8039752403e09e09c2bc256 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Mon, 14 Nov 2016 07:43:08 +0900 Subject: [PATCH] Add a couple more tests --- tests/test_util.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_util.py b/tests/test_util.py index 0e92deb..a6b79ef 100644 --- a/tests/test_util.py +++ b/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():