diff tests/conftest.py @ 2:59fe8cb6190d

Add lots of tests, fix lots of bugs.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 03 Jan 2017 09:05:28 -0800
parents 74b83e3d921e
children ee741bbe96a8
line wrap: on
line diff
--- a/tests/conftest.py	Mon Jan 02 21:54:59 2017 -0800
+++ b/tests/conftest.py	Tue Jan 03 09:05:28 2017 -0800
@@ -1,3 +1,4 @@
+import re
 import sys
 import logging
 import yaml
@@ -6,9 +7,9 @@
     FontaineSceneElement,
     TYPE_ACTION, TYPE_CENTEREDACTION, TYPE_CHARACTER, TYPE_DIALOG,
     TYPE_PARENTHETICAL, TYPE_TRANSITION, TYPE_LYRICS, TYPE_PAGEBREAK,
+    TYPE_EMPTYLINES,
     _scene_element_type_str)
 from fontaine.parser import FontaineParser, FontaineParserError
-from fontaine.renderer import BaseRenderer
 
 
 def pytest_addoption(parser):
@@ -153,6 +154,9 @@
                                       p.text)
 
 
+RE_BLANK_LINE = re.compile(r"^\s+$")
+
+
 def make_scenes(spec):
     if not isinstance(spec, list):
         raise Exception("Script specs must be lists.")
@@ -166,6 +170,11 @@
             cur_paras.append(FontaineSceneElement(TYPE_PAGEBREAK, None))
             continue
 
+        if RE_BLANK_LINE.match(item):
+            text = len(item) * '\n'
+            cur_paras.append(FontaineSceneElement(TYPE_EMPTYLINES, text))
+            continue
+
         token = item[:1]
         if token == '.':
             if cur_header or cur_paras:
@@ -193,14 +202,3 @@
     if cur_header or cur_paras:
         out.append([cur_header] + cur_paras)
     return out
-
-
-class TestRenderer(BaseRenderer):
-    def write_bold(self, text):
-        pass
-
-    def write_italics(self, text):
-        pass
-
-    def write_underline(self, text):
-        pass