Bläddra i källkod

Add test_integration(); add a horrible abuse of PEP8

tags/v0.2
Ben Kurtovic 11 år sedan
förälder
incheckning
094e867ee6
2 ändrade filer med 21 tillägg och 1 borttagningar
  1. +1
    -1
      tests/_test_tree_equality.py
  2. +20
    -0
      tests/test_builder.py

+ 1
- 1
tests/_test_tree_equality.py Visa fil

@@ -74,7 +74,7 @@ class TreeEqualityTestCase(TestCase):
self.assertEqual(expected.value, actual.value)
self.assertIs(expected.named, actual.named)
self.assertIs(expected.hexadecimal, actual.hexadecimal)
self.assertEquals(expected.hex_char, actual.hex_char)
self.assertEqual(expected.hex_char, actual.hex_char)

def assertTagNodeEqual(self, expected, actual):
"""Assert that two Tag nodes have the same data."""


+ 20
- 0
tests/test_builder.py Visa fil

@@ -204,5 +204,25 @@ class TestBuilder(TreeEqualityTestCase):
"""tests for building Tag nodes"""
pass

def test_integration(self):
"""a test for building a combination of templates together"""
test = [tokens.TemplateOpen(), tokens.TemplateOpen(),
tokens.TemplateOpen(), tokens.TemplateOpen(),
tokens.Text(text="foo"), tokens.TemplateClose(),
tokens.Text(text="bar"), tokens.TemplateParamSeparator(),
tokens.Text(text="baz"), tokens.TemplateParamEquals(),
tokens.Text(text="biz"), tokens.TemplateClose(),
tokens.Text(text="buzz"), tokens.TemplateClose(),
tokens.Text(text="usr"), tokens.TemplateParamSeparator(),
tokens.TemplateOpen(), tokens.Text(text="bin"),
tokens.TemplateClose(), tokens.TemplateClose()]
valid = wrap(
[Template(wrap([Template(wrap([Template(wrap([Template(wrap([Text(
"foo")])), Text("bar")]), params=[Parameter(wrap([Text("baz")]),
wrap([Text("biz")]))]), Text("buzz")])), Text("usr")]), params=[
Parameter(wrap([Text("1")]), wrap([Template(wrap([Text("bin")]))]),
showkey=False)])])
self.assertWikicodeEqual(valid, self.builder.build(test))

if __name__ == "__main__":
unittest.main(verbosity=2)

Laddar…
Avbryt
Spara