From 471fda12cf496f3bee4aa3aad7e04a2cc7073c8a Mon Sep 17 00:00:00 2001 From: Martin Vilcans Date: Wed, 24 Aug 2011 01:11:59 +0200 Subject: New spec for transitions. The rule that a transition must be followed by a slug is not implemented. --- tests/parse_test.py | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'tests/parse_test.py') diff --git a/tests/parse_test.py b/tests/parse_test.py index 75d762a..1eabdb2 100644 --- a/tests/parse_test.py +++ b/tests/parse_test.py @@ -95,8 +95,6 @@ class ParseTests(unittest2.TestCase): self.assertEquals([(False, 'Fuck retirement!')], dual.right.blocks) def test_standard_transition(self): - # Need clarification of the spec here, see - # http://prolost.com/blog/2011/8/9/screenplay-markdown.html?lastPage=true#comment14865294 paras = list(parse.parse([ 'Jack begins to argue vociferously in Vietnamese (?)', @@ -107,5 +105,48 @@ class ParseTests(unittest2.TestCase): ])) self.assertEquals([Action, Transition, Slug], [type(p) for p in paras]) + def test_standard_transition(self): + + paras = list(parse.parse([ + 'Jack begins to argue vociferously in Vietnamese (?)', + '', + 'CUT TO:', + '', + "EXT. BRICK'S POOL - DAY", + ])) + self.assertEquals([Action, Transition, Slug], [type(p) for p in paras]) + + def test_transition_needs_to_be_upper_case(self): + paras = list(parse.parse([ + 'Jack begins to argue vociferously in Vietnamese (?)', + '', + 'cut to:', + '', + "EXT. BRICK'S POOL - DAY", + ])) + self.assertEquals([Action, Action, Slug], [type(p) for p in paras]) + + def test_not_a_transition_on_trailing_whitespace(self): + paras = list(parse.parse([ + 'Jack begins to argue vociferously in Vietnamese (?)', + '', + 'CUT TO: ', + '', + "EXT. BRICK'S POOL - DAY", + ])) + self.assertEquals([Action, Action, Slug], [type(p) for p in paras]) + + # Not implemented yet + @unittest2.expectedFailure + def test_transition_must_be_followed_by_slug(self): + paras = list(parse.parse([ + 'Bill lights a cigarette.', + '', + 'CUT TO:', + '', + 'SOME GUY mowing the lawn.', + ])) + self.assertEquals([Action, Action, Action], [type(p) for p in paras]) + if __name__ == '__main__': unittest2.main() -- cgit v1.2.3