diff options
author | Martin Vilcans <martin@librador.com> | 2012-02-08 00:05:01 +0100 |
---|---|---|
committer | Martin Vilcans <martin@librador.com> | 2012-02-08 00:05:10 +0100 |
commit | 429e3a428d3bd7f681bea753525dcffba078c4bf (patch) | |
tree | 1155c601202b7a2576a5a1edcfa90bb94bbffec0 /tests | |
parent | b2dbd04a50a159ba18caa152ae98267a16f89c28 (diff) | |
download | screenplain-429e3a428d3bd7f681bea753525dcffba078c4bf.tar.gz |
Added support for sections
Diffstat (limited to 'tests')
-rw-r--r-- | tests/files/sections.spmd | 13 | ||||
-rw-r--r-- | tests/files/sections.spmd.html | 7 | ||||
-rw-r--r-- | tests/files_test.py | 6 | ||||
-rw-r--r-- | tests/spmd_test.py | 16 |
4 files changed, 41 insertions, 1 deletions
diff --git a/tests/files/sections.spmd b/tests/files/sections.spmd new file mode 100644 index 0000000..96a2266 --- /dev/null +++ b/tests/files/sections.spmd @@ -0,0 +1,13 @@ +# First level + +## Second level + +EXT. STREET - DAWN + +DAWN walks down the street. + +## Second level again + +EXT. ALLEY - CONTINUOUS + +Dawn walks into this place. diff --git a/tests/files/sections.spmd.html b/tests/files/sections.spmd.html new file mode 100644 index 0000000..d06decb --- /dev/null +++ b/tests/files/sections.spmd.html @@ -0,0 +1,7 @@ +<h1>First level</h1> +<h2>Second level</h2> +<h6>EXT. STREET - DAWN</h6> +<div class="action"><p>DAWN walks down the street.</p></div> +<h2>Second level again</h2> +<h6>EXT. ALLEY - CONTINUOUS</h6> +<div class="action"><p>Dawn walks into this place.</p></div> diff --git a/tests/files_test.py b/tests/files_test.py index 1637dda..41d17bb 100644 --- a/tests/files_test.py +++ b/tests/files_test.py @@ -64,3 +64,9 @@ class ParseTests(unittest2.TestCase): 'scene-numbers.spmd', 'scene-numbers.html', 'scene-numbers.spmd.html', '--bare') self.assertMultiLineEqual(expected, actual) + + def test_sections(self): + actual, expected = self.convert( + 'sections.spmd', 'sections.html', + 'sections.spmd.html', '--bare') + self.assertMultiLineEqual(expected, actual) diff --git a/tests/spmd_test.py b/tests/spmd_test.py index 21f39ae..aac8df9 100644 --- a/tests/spmd_test.py +++ b/tests/spmd_test.py @@ -4,7 +4,9 @@ import unittest2 from screenplain.parsers.spmd import parse -from screenplain.types import Slug, Action, Dialog, DualDialog, Transition +from screenplain.types import ( + Slug, Action, Dialog, DualDialog, Transition, Section +) from screenplain.richstring import plain, italic, empty_string @@ -80,6 +82,18 @@ class ParseTests(unittest2.TestCase): paras[0].line ) + def test_section_parsed_correctly(self): + paras = parse([ + '# first level', + '', + '## second level', + ]) + self.assertEquals([Section, Section], [type(p) for p in paras]) + self.assertEquals(1, paras[0].level) + self.assertEquals(plain('first level'), paras[0].text) + self.assertEquals(2, paras[1].level) + self.assertEquals(plain('second level'), paras[1].text) + # A Character element is any line entirely in caps, with one empty # line before it and without an empty line after it. def test_all_caps_is_character(self): |