From ef55b8c79ae2d3e593aacb7a1f4a3c893bf62094 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Wed, 28 Oct 2009 16:09:42 +0000 Subject: [PATCH] Move parse_format tests to test_formats.py Signed-off-by: Chris Lamb --- tests/test_formats.py | 31 +++++++++++++++++++++++++++++++ tests/test_srcformats.py | 22 ---------------------- 2 files changed, 31 insertions(+), 22 deletions(-) create mode 100755 tests/test_formats.py diff --git a/tests/test_formats.py b/tests/test_formats.py new file mode 100755 index 00000000..8a2b1ad5 --- /dev/null +++ b/tests/test_formats.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +import unittest + +import os, sys +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + +from daklib.formats import parse_format +from daklib.dak_exceptions import UnknownFormatError + +class ParseFormatTestCase(unittest.TestCase): + def assertParse(self, format, expected): + self.assertEqual(parse_format(format), expected) + + def assertParseFail(self, format): + self.assertRaises( + UnknownFormatError, + lambda: parse_format(format) + ) + + def testParse(self): + self.assertParse('1.0', (1, 0)) + + def testEmpty(self): + self.assertParseFail('') + self.assertParseFail(' ') + self.assertParseFail(' ') + + def textText(self): + self.assertParse('1.2 (three)', (1, 2, 'three')) + self.assertParseFail('0.0 ()') diff --git a/tests/test_srcformats.py b/tests/test_srcformats.py index 1e78981b..9bc0ddf2 100755 --- a/tests/test_srcformats.py +++ b/tests/test_srcformats.py @@ -106,28 +106,6 @@ class FormatTreeQuiltTestCase(SourceFormatTestCase): ## -class ParseFormatTestCase(unittest.TestCase): - def assertParse(self, format, expected): - self.assertEqual(parse_format(format), expected) - - def assertParseFail(self, format): - self.assertRaises( - UnknownFormatError, - lambda: parse_format(format) - ) - - def testParse(self): - self.assertParse('1.0', (1, 0)) - - def testEmpty(self): - self.assertParseFail('') - self.assertParseFail(' ') - self.assertParseFail(' ') - - def textText(self): - self.assertParse('1.2 (three)', (1, 2, 'three')) - self.assertParseFail('0.0 ()') - class ValidateFormatTestCase(unittest.TestCase): def assertValid(self, format, **kwargs): kwargs['is_a_dsc'] = kwargs.get('is_a_dsc', True) -- 2.39.5