| @@ -30,6 +30,7 @@ __all__ = ["Argument"] | |||||
| class Argument(Node): | class Argument(Node): | ||||
| """Represents a template argument substitution, like ``{{{foo}}}``.""" | """Represents a template argument substitution, like ``{{{foo}}}``.""" | ||||
| def __init__(self, name, default=None): | def __init__(self, name, default=None): | ||||
| super(Argument, self).__init__() | super(Argument, self).__init__() | ||||
| self._name = name | self._name = name | ||||
| @@ -29,6 +29,7 @@ __all__ = ["Comment"] | |||||
| class Comment(Node): | class Comment(Node): | ||||
| """Represents a hidden HTML comment, like ``<!-- foobar -->``.""" | """Represents a hidden HTML comment, like ``<!-- foobar -->``.""" | ||||
| def __init__(self, contents): | def __init__(self, contents): | ||||
| super(Comment, self).__init__() | super(Comment, self).__init__() | ||||
| self._contents = contents | self._contents = contents | ||||
| @@ -29,6 +29,7 @@ __all__ = ["Text"] | |||||
| class Text(Node): | class Text(Node): | ||||
| """Represents ordinary, unformatted text with no special properties.""" | """Represents ordinary, unformatted text with no special properties.""" | ||||
| def __init__(self, value): | def __init__(self, value): | ||||
| super(Text, self).__init__() | super(Text, self).__init__() | ||||
| self._value = value | self._value = value | ||||
| @@ -30,6 +30,7 @@ __all__ = ["Wikilink"] | |||||
| class Wikilink(Node): | class Wikilink(Node): | ||||
| """Represents an internal wikilink, like ``[[Foo|Bar]]``.""" | """Represents an internal wikilink, like ``[[Foo|Bar]]``.""" | ||||
| def __init__(self, title, text=None): | def __init__(self, title, text=None): | ||||
| super(Wikilink, self).__init__() | super(Wikilink, self).__init__() | ||||
| self._title = title | self._title = title | ||||
| @@ -50,6 +50,7 @@ class StringMixIn(object): | |||||
| :py:meth:`__unicode__` instead of the immutable ``self`` like the regular | :py:meth:`__unicode__` instead of the immutable ``self`` like the regular | ||||
| ``str`` type. | ``str`` type. | ||||
| """ | """ | ||||
| if py3k: | if py3k: | ||||
| def __str__(self): | def __str__(self): | ||||
| return self.__unicode__() | return self.__unicode__() | ||||
| @@ -38,6 +38,7 @@ class TokenizerTestCase(object): | |||||
| TestCTokenizer. Tests are loaded dynamically from files in the 'tokenizer' | TestCTokenizer. Tests are loaded dynamically from files in the 'tokenizer' | ||||
| directory. | directory. | ||||
| """ | """ | ||||
| @classmethod | @classmethod | ||||
| def _build_test_method(cls, funcname, data): | def _build_test_method(cls, funcname, data): | ||||
| """Create and return a method to be treated as a test case method. | """Create and return a method to be treated as a test case method. | ||||
| @@ -27,6 +27,7 @@ from _test_tokenizer import TokenizerTestCase | |||||
| class TestCTokenizer(TokenizerTestCase, unittest.TestCase): | class TestCTokenizer(TokenizerTestCase, unittest.TestCase): | ||||
| """Test cases for the C tokenizer.""" | """Test cases for the C tokenizer.""" | ||||
| @classmethod | @classmethod | ||||
| def setUpClass(cls): | def setUpClass(cls): | ||||
| from mwparserfromhell.parser._tokenizer import CTokenizer | from mwparserfromhell.parser._tokenizer import CTokenizer | ||||
| @@ -30,6 +30,7 @@ from mwparserfromhell.compat import py3k, str, StringIO | |||||
| class TestDocs(unittest.TestCase): | class TestDocs(unittest.TestCase): | ||||
| """Integration test cases for mwparserfromhell's documentation.""" | """Integration test cases for mwparserfromhell's documentation.""" | ||||
| def assertPrint(self, input, output): | def assertPrint(self, input, output): | ||||
| """Assertion check that *input*, when printed, produces *output*.""" | """Assertion check that *input*, when printed, produces *output*.""" | ||||
| buff = StringIO() | buff = StringIO() | ||||
| @@ -27,6 +27,7 @@ from _test_tokenizer import TokenizerTestCase | |||||
| class TestPyTokenizer(TokenizerTestCase, unittest.TestCase): | class TestPyTokenizer(TokenizerTestCase, unittest.TestCase): | ||||
| """Test cases for the Python tokenizer.""" | """Test cases for the Python tokenizer.""" | ||||
| @classmethod | @classmethod | ||||
| def setUpClass(cls): | def setUpClass(cls): | ||||
| from mwparserfromhell.parser.tokenizer import Tokenizer | from mwparserfromhell.parser.tokenizer import Tokenizer | ||||
| @@ -384,7 +384,5 @@ class TestSmartList(unittest.TestCase): | |||||
| self.assertEquals([4, 3, 2, 1.9, 1.8, 5, 6, 7, 8, 8.1, 8.2], child1) | self.assertEquals([4, 3, 2, 1.9, 1.8, 5, 6, 7, 8, 8.1, 8.2], child1) | ||||
| self.assertEquals([4, 3, 2, 1.9, 1.8], child2) | self.assertEquals([4, 3, 2, 1.9, 1.8], child2) | ||||
| # also test whether children that exit scope are removed from parent's map | |||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||
| unittest.main(verbosity=2) | unittest.main(verbosity=2) | ||||
| @@ -37,6 +37,7 @@ class _FakeString(StringMixIn): | |||||
| class TestStringMixIn(unittest.TestCase): | class TestStringMixIn(unittest.TestCase): | ||||
| """Test cases for the StringMixIn class.""" | """Test cases for the StringMixIn class.""" | ||||
| def test_docs(self): | def test_docs(self): | ||||
| """make sure the various methods of StringMixIn have docstrings""" | """make sure the various methods of StringMixIn have docstrings""" | ||||
| methods = [ | methods = [ | ||||