From 121dd5374458b38b2ab2a7e2acf30f5256a8d251 Mon Sep 17 00:00:00 2001 From: Martin Vilcans Date: Tue, 13 Aug 2013 18:34:19 +0200 Subject: Removed dependency on unittest2 I think I don't use its features and it doesn't exist under that name in Python 3. --- tests/fdx_test.py | 4 ++-- tests/files_test.py | 4 ++-- tests/fountain_test.py | 21 +++++++++------------ tests/richstring_test.py | 12 ++++++------ 4 files changed, 19 insertions(+), 22 deletions(-) (limited to 'tests') diff --git a/tests/fdx_test.py b/tests/fdx_test.py index 1aceb3a..8034f71 100644 --- a/tests/fdx_test.py +++ b/tests/fdx_test.py @@ -2,14 +2,14 @@ # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license.php -import unittest2 +from unittest import TestCase from StringIO import StringIO from screenplain.export.fdx import write_text from screenplain.richstring import plain, bold, italic -class OutputTests(unittest2.TestCase): +class OutputTests(TestCase): def setUp(self): self.out = StringIO() diff --git a/tests/files_test.py b/tests/files_test.py index 63c4fa6..dc799bc 100644 --- a/tests/files_test.py +++ b/tests/files_test.py @@ -4,7 +4,7 @@ from __future__ import with_statement -import unittest2 +from unittest import TestCase import tempfile import os import os.path @@ -36,7 +36,7 @@ def clean_string(s): return spaces_re.sub(' ', line_break_re.sub('\n', s)) -class FileTests(unittest2.TestCase): +class FileTests(TestCase): """High level tests that runs Screenplain using command line arguments. """ diff --git a/tests/fountain_test.py b/tests/fountain_test.py index f688fa5..5095e4e 100644 --- a/tests/fountain_test.py +++ b/tests/fountain_test.py @@ -2,7 +2,7 @@ # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license.php -import unittest2 +from unittest import TestCase from screenplain.parsers import fountain from screenplain.types import ( Slug, Action, Dialog, DualDialog, Transition, Section, PageBreak @@ -16,7 +16,7 @@ def parse(lines): return fountain.parse(StringIO(content)) -class SlugTests(unittest2.TestCase): +class SlugTests(TestCase): def test_slug_with_prefix(self): paras = list(parse([ 'INT. SOMEWHERE - DAY', @@ -92,7 +92,7 @@ class SlugTests(unittest2.TestCase): ) -class SectionTests(unittest2.TestCase): +class SectionTests(TestCase): def test_section_parsed_correctly(self): paras = parse([ '# first level', @@ -134,7 +134,7 @@ class SectionTests(unittest2.TestCase): ], paras) -class DialogTests(unittest2.TestCase): +class DialogTests(TestCase): # 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): @@ -247,7 +247,7 @@ class DialogTests(unittest2.TestCase): ], paras[0].blocks) -class TransitionTests(unittest2.TestCase): +class TransitionTests(TestCase): def test_standard_transition(self): paras = list(parse([ @@ -332,7 +332,7 @@ class TransitionTests(unittest2.TestCase): self.assertEquals(plain('FADE OUT.'), paras[1].line) -class ActionTests(unittest2.TestCase): +class ActionTests(TestCase): def test_action_preserves_leading_whitespace(self): paras = list(parse([ @@ -390,7 +390,7 @@ class ActionTests(unittest2.TestCase): self.assertEquals([plain(line) for line in lines], paras[0].lines) -class SynopsisTests(unittest2.TestCase): +class SynopsisTests(TestCase): def test_synopsis_after_slug_adds_synopsis_to_scene(self): paras = list(parse([ "EXT. BRICK'S PATIO - DAY", @@ -429,7 +429,7 @@ class SynopsisTests(unittest2.TestCase): ) -class TitlePageTests(unittest2.TestCase): +class TitlePageTests(TestCase): def test_basic_title_page(self): lines = [ @@ -482,7 +482,7 @@ class TitlePageTests(unittest2.TestCase): self.assertIsNone(fountain.parse_title_page(lines)) -class PageBreakTests(unittest2.TestCase): +class PageBreakTests(TestCase): def test_page_break_is_parsed(self): paras = list(parse([ '====', @@ -490,6 +490,3 @@ class PageBreakTests(unittest2.TestCase): 'So here we go' ])) self.assertEquals([PageBreak, Action], [type(p) for p in paras]) - -if __name__ == '__main__': - unittest2.main() diff --git a/tests/richstring_test.py b/tests/richstring_test.py index 65e1ea7..b9ca3d2 100644 --- a/tests/richstring_test.py +++ b/tests/richstring_test.py @@ -2,7 +2,7 @@ # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license.php -import unittest2 +from unittest import TestCase from screenplain.richstring import ( RichString, Segment, Bold, Italic, @@ -13,7 +13,7 @@ from screenplain.richstring import parse_emphasis from screenplain.types import Slug, Action, Dialog, DualDialog, Transition -class LowLevelRichStringTests(unittest2.TestCase): +class LowLevelRichStringTests(TestCase): def test_plain_string_has_one_single_segment(self): s = plain('hello') @@ -22,7 +22,7 @@ class LowLevelRichStringTests(unittest2.TestCase): self.assertEqual(set(), s.segments[0].styles) -class RichStringOperatorTests(unittest2.TestCase): +class RichStringOperatorTests(TestCase): def test_repr(self): s = bold('Hello') + plain(' there ') + bold('folks') @@ -57,7 +57,7 @@ class RichStringOperatorTests(unittest2.TestCase): self.assertEquals(expected, result) -class StyleGeneratorTests(unittest2.TestCase): +class StyleGeneratorTests(TestCase): def test_bold_function_creates_bold_richstring(self): self.assertEquals( @@ -72,7 +72,7 @@ class StyleGeneratorTests(unittest2.TestCase): ) -class RichStringTests(unittest2.TestCase): +class RichStringTests(TestCase): def test_plain_to_html(self): self.assertEquals('hello', plain('hello').to_html()) @@ -88,7 +88,7 @@ class RichStringTests(unittest2.TestCase): ) -class ParseEmphasisTests(unittest2.TestCase): +class ParseEmphasisTests(TestCase): def test_parse_without_emphasis(self): self.assertEquals( -- cgit