From: Cefn Hoile Date: Sun, 18 Feb 2018 01:28:19 +0000 (+0000) Subject: Commented X-Git-Tag: 0.1.0~4^2~133 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/dc5b11cc7b15a38cf554561b477580959fa44cb3 Commented --- diff --git a/python/testing/mcp.py b/python/testing/mcp.py index 61642a3..131def0 100644 --- a/python/testing/mcp.py +++ b/python/testing/mcp.py @@ -8,6 +8,7 @@ class TestEnum(unittest.TestCase): """ def setUp(self): + """Create an example Enum, mocking __module__ and __qualname__""" import mcp class Cls(mcp.Enum): pass @@ -20,11 +21,13 @@ class TestEnum(unittest.TestCase): def test_iteritems(self): + """A subtype of Enum can list all attributes of its own type""" items = list(self.Cls.iteritems()) self.assertEqual( items, [("one",self.Cls.one),("two",self.Cls.two),]) def test_repr(self): + """A repr() call on an Enum gives its fully-qualified name""" name = "one" actual = repr(getattr(self.Cls, name)) expected = "{}.{}.{}".format(self.Cls.__module__, self.Cls.__qualname__, name) @@ -32,4 +35,5 @@ class TestEnum(unittest.TestCase): def test_str(self): + """A str() call on an Enum performs the same as repr()""" self.assertEqual(str(self.Cls.one), repr(self.Cls.one)) \ No newline at end of file