From ef1635819c057f634cb776b9c57c7d1348b88c26 Mon Sep 17 00:00:00 2001 From: Martin Vilcans Date: Tue, 7 Feb 2012 22:26:14 +0100 Subject: Added scene numbers --- tests/files/scene-numbers.spmd | 7 +++++++ tests/files/scene-numbers.spmd.html | 4 ++++ tests/files_test.py | 6 ++++++ tests/spmd_test.py | 16 +++++++++++++++- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tests/files/scene-numbers.spmd create mode 100644 tests/files/scene-numbers.spmd.html (limited to 'tests') diff --git a/tests/files/scene-numbers.spmd b/tests/files/scene-numbers.spmd new file mode 100644 index 0000000..51064d2 --- /dev/null +++ b/tests/files/scene-numbers.spmd @@ -0,0 +1,7 @@ +INT. SOMEWHERE - DAY #1# + +Bla bla + +INT. SOMEWHERE ELSE - NIGHT #2# + +Bla bla diff --git a/tests/files/scene-numbers.spmd.html b/tests/files/scene-numbers.spmd.html new file mode 100644 index 0000000..8179c79 --- /dev/null +++ b/tests/files/scene-numbers.spmd.html @@ -0,0 +1,4 @@ +

1INT. SOMEWHERE - DAY1

+

Bla bla

+

2INT. SOMEWHERE ELSE - NIGHT2

+

Bla bla

diff --git a/tests/files_test.py b/tests/files_test.py index af478fb..1637dda 100644 --- a/tests/files_test.py +++ b/tests/files_test.py @@ -58,3 +58,9 @@ class ParseTests(unittest2.TestCase): actual, expected = self.convert( 'simple.spmd', 'simple.html', 'simple.spmd.html', '--bare') self.assertMultiLineEqual(expected, actual) + + def test_scene_numbers(self): + actual, expected = self.convert( + 'scene-numbers.spmd', 'scene-numbers.html', + 'scene-numbers.spmd.html', '--bare') + self.assertMultiLineEqual(expected, actual) diff --git a/tests/spmd_test.py b/tests/spmd_test.py index 9f03076..b317b56 100644 --- a/tests/spmd_test.py +++ b/tests/spmd_test.py @@ -5,7 +5,7 @@ import unittest2 from screenplain.parsers.spmd import parse from screenplain.types import Slug, Action, Dialog, DualDialog, Transition -from screenplain.richstring import plain, empty_string +from screenplain.richstring import plain, italic, empty_string class ParseTests(unittest2.TestCase): @@ -62,6 +62,20 @@ class ParseTests(unittest2.TestCase): self.assertEquals(Slug, type(paras[0])) self.assertEquals(plain('SNIPER SCOPE POV'), paras[0].line) + def test_scene_number_is_parsed(self): + paras = parse(['EXT SOMEWHERE - DAY #42#']) + self.assertEquals(plain('EXT SOMEWHERE - DAY'), paras[0].line) + self.assertEquals(plain('42'), paras[0].scene_number) + + def test_only_last_two_hashes_in_slug_used_for_scene_number(self): + paras = parse(['INT ROOM #237 #42#']) + self.assertEquals(plain('42'), paras[0].scene_number) + self.assertEquals(plain('INT ROOM #237'), paras[0].line) + + def test_scene_number_can_be_styled(self): + paras = parse(['.SOMEWHERE #*HELLO*#']) + self.assertEquals(italic('HELLO'), paras[0].scene_number) + # 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): -- cgit