From fe3328aa386c9212d19cebeb3a0c5e626c53b7fc Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 22 Mar 2013 08:38:29 -0400 Subject: [PATCH] test_doctest() --- mwparserfromhell/smart_list.py | 2 +- tests/test_smart_list.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mwparserfromhell/smart_list.py b/mwparserfromhell/smart_list.py index 67d96be..7c29c60 100644 --- a/mwparserfromhell/smart_list.py +++ b/mwparserfromhell/smart_list.py @@ -363,4 +363,4 @@ class _ListProxy(list): self._parent[self._start:self._stop:self._step] = item -del inheritdoc \ No newline at end of file +del inheritdoc diff --git a/tests/test_smart_list.py b/tests/test_smart_list.py index e22ad27..b83f4d3 100644 --- a/tests/test_smart_list.py +++ b/tests/test_smart_list.py @@ -38,5 +38,15 @@ class TestSmartList(unittest.TestCase): self.assertEquals(expected, smartlist_doc) self.assertEquals(expected, listproxy_doc) + def test_doctest(self): + """make sure a test embedded in SmartList's docstring passes""" + parent = SmartList([0, 1, 2, 3]) + self.assertEquals([0, 1, 2, 3], parent) + child = parent[2:] + self.assertEquals([2, 3], child) + child.append(4) + self.assertEquals([2, 3, 4], child) + self.assertEquals([0, 1, 2, 3, 4], parent) + if __name__ == "__main__": unittest.main(verbosity=2)