Browse Source

test_doctest()

tags/v0.2
Ben Kurtovic 11 years ago
parent
commit
fe3328aa38
2 changed files with 11 additions and 1 deletions
  1. +1
    -1
      mwparserfromhell/smart_list.py
  2. +10
    -0
      tests/test_smart_list.py

+ 1
- 1
mwparserfromhell/smart_list.py View File

@@ -363,4 +363,4 @@ class _ListProxy(list):
self._parent[self._start:self._stop:self._step] = item


del inheritdoc
del inheritdoc

+ 10
- 0
tests/test_smart_list.py View File

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

Loading…
Cancel
Save