Browse Source

Code cleaning

pull/172/head
Oliverpool 9 years ago
parent
commit
46ab0b047f
  1. 1
      patacrep/songs/chordpro/syntax.py
  2. 8
      test/test_chordpro/test_parser.py

1
patacrep/songs/chordpro/syntax.py

@ -319,6 +319,5 @@ def parse_song(content, filename=None):
lexer=ChordProLexer(filename=filename).lexer, lexer=ChordProLexer(filename=filename).lexer,
) )
if parsed_content is None: if parsed_content is None:
# There was a fatal error parsing the content
raise SyntaxError('Fatal error during song parsing: {}'.format(filename)) raise SyntaxError('Fatal error during song parsing: {}'.format(filename))
return parsed_content return parsed_content

8
test/test_chordpro/test_parser.py

@ -103,11 +103,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest):
def _create_test(cls, base, dest): def _create_test(cls, base, dest):
"""Return a function testing that `base` compilation in `dest` format. """Return a function testing that `base` compilation in `dest` format.
""" """
test_parse_render = lambda self: self.assertRender(base, dest)
def test_parse_render(self):
"""Test that `base` is correctly parsed and rendered."""
self.assertRender(base, dest)
test_parse_render.__doc__ = ( test_parse_render.__doc__ = (
"Test that '{base}' is correctly parsed and rendererd into '{format}' format." "Test that '{base}' is correctly parsed and rendererd into '{format}' format."
).format(base=os.path.basename(base), format=dest) ).format(base=os.path.basename(base), format=dest)
@ -115,7 +111,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest):
@classmethod @classmethod
def _create_failure(cls, base): def _create_failure(cls, base):
"""Return a function testing that `base` fails. """Return a function testing that `base` parsing fails.
""" """
def test_parse_render(self): def test_parse_render(self):

Loading…
Cancel
Save