From 865e980579132926269dd56ff07743e7538167ee Mon Sep 17 00:00:00 2001
From: oliverpool
Date: Sat, 1 Jul 2017 23:56:12 +0200
Subject: [PATCH] fix newline tests
---
patacrep/songs/chordpro/ast.py | 2 +-
patacrep/songs/chordpro/syntax.py | 3 ++-
test/test_patatools/test_convert.py | 6 ++----
test/test_song/newline.crlf.csg | 2 +-
test/test_song/newline.crlf.html | 2 +-
test/test_song/newline.crlf.tsg | 2 +-
test/test_song/newline.csg | 2 +-
test/test_song/newline.html | 2 +-
test/test_song/newline.tsg | 2 +-
9 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/patacrep/songs/chordpro/ast.py b/patacrep/songs/chordpro/ast.py
index 380d1437..bca092b6 100644
--- a/patacrep/songs/chordpro/ast.py
+++ b/patacrep/songs/chordpro/ast.py
@@ -388,7 +388,7 @@ class VerseDirective(Directive):
def __init__(self, keyword, argument=None):
if keyword not in VERSE_DIRECTIVES:
#TODO Raise better exception
- raise Exception
+ raise Exception(keyword)
super().__init__(keyword, argument)
@property
diff --git a/patacrep/songs/chordpro/syntax.py b/patacrep/songs/chordpro/syntax.py
index b44d0334..bb294143 100644
--- a/patacrep/songs/chordpro/syntax.py
+++ b/patacrep/songs/chordpro/syntax.py
@@ -262,7 +262,8 @@ class ChordproParser(Parser):
keyword = symbols[3]
argument = symbols[4]
- symbols[0] = ast.VerseDirective(keyword, argument)
+ if keyword != "newline":
+ symbols[0] = ast.VerseDirective(keyword, argument)
@staticmethod
def p_directive_next(symbols):
diff --git a/test/test_patatools/test_convert.py b/test/test_patatools/test_convert.py
index f882fe88..437a54c0 100644
--- a/test/test_patatools/test_convert.py
+++ b/test/test_patatools/test_convert.py
@@ -70,10 +70,8 @@ class TestConvert(unittest.TestCase, metaclass=dynamic.DynamicTest):
with logging_reduced():
if os.path.exists(destname):
os.remove(destname)
- self.assertEqual(
- self._system(main, args + [in_format, out_format, sourcename]),
- 1,
- )
+ with self.assertRaises(Exception):
+ self._system(main, args + [in_format, out_format, sourcename])
@staticmethod
@contextlib.contextmanager
diff --git a/test/test_song/newline.crlf.csg b/test/test_song/newline.crlf.csg
index e9bf0c62..5ebdcec7 100644
--- a/test/test_song/newline.crlf.csg
+++ b/test/test_song/newline.crlf.csg
@@ -38,4 +38,4 @@ New lines can also
Be surrounded by spaces
-New lines cannot
+New lines cannot appear in the middle of a line
diff --git a/test/test_song/newline.crlf.html b/test/test_song/newline.crlf.html
index 5540af64..d29e7530 100644
--- a/test/test_song/newline.crlf.html
+++ b/test/test_song/newline.crlf.html
@@ -38,6 +38,6 @@ Be in bridges
Be surrounded by spaces
-New lines cannot
+
New lines cannot appear in the middle of a line
\ No newline at end of file
diff --git a/test/test_song/newline.crlf.tsg b/test/test_song/newline.crlf.tsg
index d557de5f..5122de62 100644
--- a/test/test_song/newline.crlf.tsg
+++ b/test/test_song/newline.crlf.tsg
@@ -55,7 +55,7 @@
\begin{verse}
- New lines cannot
+ New lines cannot appear in the middle of a line
\end{verse}
\endsong
diff --git a/test/test_song/newline.csg b/test/test_song/newline.csg
index e9bf0c62..5ebdcec7 100644
--- a/test/test_song/newline.csg
+++ b/test/test_song/newline.csg
@@ -38,4 +38,4 @@ New lines can also
Be surrounded by spaces
-New lines cannot
+New lines cannot appear in the middle of a line
diff --git a/test/test_song/newline.html b/test/test_song/newline.html
index 5540af64..d29e7530 100644
--- a/test/test_song/newline.html
+++ b/test/test_song/newline.html
@@ -38,6 +38,6 @@ Be in bridges
Be surrounded by spaces
-New lines cannot
+
New lines cannot appear in the middle of a line
\ No newline at end of file
diff --git a/test/test_song/newline.tsg b/test/test_song/newline.tsg
index d557de5f..5122de62 100644
--- a/test/test_song/newline.tsg
+++ b/test/test_song/newline.tsg
@@ -55,7 +55,7 @@
\begin{verse}
- New lines cannot
+ New lines cannot appear in the middle of a line
\end{verse}
\endsong