Bläddra i källkod

Clean up some repetitive lines.

tags/v0.2
Ben Kurtovic 11 år sedan
förälder
incheckning
eea5c774e3
6 ändrade filer med 24 tillägg och 43 borttagningar
  1. +4
    -9
      tests/test_argument.py
  2. +3
    -4
      tests/test_comment.py
  3. +3
    -4
      tests/test_heading.py
  4. +7
    -13
      tests/test_html_entity.py
  5. +3
    -4
      tests/test_text.py
  6. +4
    -9
      tests/test_wikilink.py

+ 4
- 9
tests/test_argument.py Visa fil

@@ -41,16 +41,11 @@ class TestArgument(TreeEqualityTestCase):
def test_strip(self):
"""test Argument.__strip__()"""
node = Argument(wrap([Text("foobar")]))
self.assertIs(None, node.__strip__(True, True))
self.assertIs(None, node.__strip__(True, False))
self.assertIs(None, node.__strip__(False, True))
self.assertIs(None, node.__strip__(False, False))

node2 = Argument(wrap([Text("foo")]), wrap([Text("bar")]))
self.assertEqual("bar", node2.__strip__(True, True))
self.assertEqual("bar", node2.__strip__(True, False))
self.assertEqual("bar", node2.__strip__(False, True))
self.assertEqual("bar", node2.__strip__(False, False))
for a in (True, False):
for b in (True, False):
self.assertIs(None, node.__strip__(a, b))
self.assertEqual("bar", node2.__strip__(a, b))

def test_showtree(self):
"""test Argument.__showtree__()"""


+ 3
- 4
tests/test_comment.py Visa fil

@@ -39,10 +39,9 @@ class TestComment(TreeEqualityTestCase):
def test_strip(self):
"""test Comment.__strip__()"""
node = Comment("foobar")
self.assertIs(None, node.__strip__(True, True))
self.assertIs(None, node.__strip__(True, False))
self.assertIs(None, node.__strip__(False, True))
self.assertIs(None, node.__strip__(False, False))
for a in (True, False):
for b in (True, False):
self.assertIs(None, node.__strip__(a, b))

def test_showtree(self):
"""test Comment.__showtree__()"""


+ 3
- 4
tests/test_heading.py Visa fil

@@ -41,10 +41,9 @@ class TestHeading(TreeEqualityTestCase):
def test_strip(self):
"""test Heading.__strip__()"""
node = Heading(wrap([Text("foobar")]), 3)
self.assertEqual("foobar", node.__strip__(True, True))
self.assertEqual("foobar", node.__strip__(True, False))
self.assertEqual("foobar", node.__strip__(False, True))
self.assertEqual("foobar", node.__strip__(False, False))
for a in (True, False):
for b in (True, False):
self.assertEqual("foobar", node.__strip__(a, b))

def test_showtree(self):
"""test Heading.__showtree__()"""


+ 7
- 13
tests/test_html_entity.py Visa fil

@@ -47,19 +47,13 @@ class TestHTMLEntity(TreeEqualityTestCase):
node1 = HTMLEntity("nbsp", named=True, hexadecimal=False)
node2 = HTMLEntity("107", named=False, hexadecimal=False)
node3 = HTMLEntity("e9", named=False, hexadecimal=True)

self.assertEqual("\xa0", node1.__strip__(True, True))
self.assertEqual("\xa0", node1.__strip__(True, False))
self.assertEqual(" ", node1.__strip__(False, True))
self.assertEqual(" ", node1.__strip__(False, False))
self.assertEqual("k", node2.__strip__(True, True))
self.assertEqual("k", node2.__strip__(True, False))
self.assertEqual("k", node2.__strip__(False, True))
self.assertEqual("k", node2.__strip__(False, False))
self.assertEqual("é", node3.__strip__(True, True))
self.assertEqual("é", node3.__strip__(True, False))
self.assertEqual("é", node3.__strip__(False, True))
self.assertEqual("é", node3.__strip__(False, False))
for a in (True, False):
self.assertEqual("\xa0", node1.__strip__(True, a))
self.assertEqual(" ", node1.__strip__(False, a))
self.assertEqual("k", node2.__strip__(True, a))
self.assertEqual("k", node2.__strip__(False, a))
self.assertEqual("é", node3.__strip__(True, a))
self.assertEqual("é", node3.__strip__(False, a))

def test_showtree(self):
"""test HTMLEntity.__showtree__()"""


+ 3
- 4
tests/test_text.py Visa fil

@@ -39,10 +39,9 @@ class TestText(unittest.TestCase):
def test_strip(self):
"""test Text.__strip__()"""
node = Text("foobar")
self.assertIs(node, node.__strip__(True, True))
self.assertIs(node, node.__strip__(True, False))
self.assertIs(node, node.__strip__(False, True))
self.assertIs(node, node.__strip__(False, False))
for a in (True, False):
for b in (True, False):
self.assertIs(node, node.__strip__(a, b))

def test_showtree(self):
"""test Text.__showtree__()"""


+ 4
- 9
tests/test_wikilink.py Visa fil

@@ -41,16 +41,11 @@ class TestWikilink(TreeEqualityTestCase):
def test_strip(self):
"""test Wikilink.__strip__()"""
node = Wikilink(wrap([Text("foobar")]))
self.assertEqual("foobar", node.__strip__(True, True))
self.assertEqual("foobar", node.__strip__(True, False))
self.assertEqual("foobar", node.__strip__(False, True))
self.assertEqual("foobar", node.__strip__(False, False))

node2 = Wikilink(wrap([Text("foo")]), wrap([Text("bar")]))
self.assertEqual("bar", node2.__strip__(True, True))
self.assertEqual("bar", node2.__strip__(True, False))
self.assertEqual("bar", node2.__strip__(False, True))
self.assertEqual("bar", node2.__strip__(False, False))
for a in (True, False):
for b in (True, False):
self.assertEqual("foobar", node.__strip__(a, b))
self.assertEqual("bar", node2.__strip__(a, b))

def test_showtree(self):
"""test Wikilink.__showtree__()"""


Laddar…
Avbryt
Spara