diff options
author | Tamir Duberstein <tamird@gmail.com> | 2015-01-13 14:47:32 -0500 |
---|---|---|
committer | Tamir Duberstein <tamird@gmail.com> | 2015-04-10 19:43:51 -0400 |
commit | 9f42f5f4a423b923f7b07ae8c5e8db4943df49c6 (patch) | |
tree | fd376cb74cae08e5bc77a8f23a797d8d5f49cc44 /python/google/protobuf/internal/text_format_test.py | |
parent | dab96f19ee2cb1dab5a403987329326ee23c2191 (diff) | |
download | protobuf-9f42f5f4a423b923f7b07ae8c5e8db4943df49c6.tar.gz protobuf-9f42f5f4a423b923f7b07ae8c5e8db4943df49c6.tar.bz2 protobuf-9f42f5f4a423b923f7b07ae8c5e8db4943df49c6.zip |
[PYTHON] Drop dependency on 'google.apputils'.
Use stdlib's 'unittest' instead.
Diffstat (limited to 'python/google/protobuf/internal/text_format_test.py')
-rwxr-xr-x | python/google/protobuf/internal/text_format_test.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/python/google/protobuf/internal/text_format_test.py b/python/google/protobuf/internal/text_format_test.py index 7d5813fb..0135099d 100755 --- a/python/google/protobuf/internal/text_format_test.py +++ b/python/google/protobuf/internal/text_format_test.py @@ -35,8 +35,8 @@ __author__ = 'kenton@google.com (Kenton Varda)' import re +import unittest -from google.apputils import basetest from google.protobuf.internal import _parameterized from google.protobuf import unittest_mset_pb2 @@ -47,7 +47,7 @@ from google.protobuf.internal import test_util from google.protobuf import text_format # Base class with some common functionality. -class TextFormatBase(basetest.TestCase): +class TextFormatBase(unittest.TestCase): def ReadGolden(self, golden_filename): with test_util.GoldenFile(golden_filename) as f: @@ -312,12 +312,12 @@ class TextFormatTest(TextFormatBase): def testParseGroupNotClosed(self, message_module): message = message_module.TestAllTypes() text = 'RepeatedGroup: <' - self.assertRaisesWithLiteralMatch( + self.assertRaisesRegexp( text_format.ParseError, '1:16 : Expected ">".', text_format.Parse, text, message) text = 'RepeatedGroup: {' - self.assertRaisesWithLiteralMatch( + self.assertRaisesRegexp( text_format.ParseError, '1:16 : Expected "}".', text_format.Parse, text, message) @@ -354,7 +354,7 @@ class TextFormatTest(TextFormatBase): def testParseBadIntValue(self, message_module): message = message_module.TestAllTypes() text = 'optional_int32: bork' - self.assertRaisesWithLiteralMatch( + self.assertRaisesRegexp( text_format.ParseError, ('1:17 : Couldn\'t parse integer: bork'), text_format.Parse, text, message) @@ -569,12 +569,12 @@ class Proto2Tests(TextFormatBase): def testParseBadExtension(self): message = unittest_pb2.TestAllExtensions() text = '[unknown_extension]: 8\n' - self.assertRaisesWithLiteralMatch( + self.assertRaisesRegexp( text_format.ParseError, '1:2 : Extension "unknown_extension" not registered.', text_format.Parse, text, message) message = unittest_pb2.TestAllTypes() - self.assertRaisesWithLiteralMatch( + self.assertRaisesRegexp( text_format.ParseError, ('1:2 : Message type "protobuf_unittest.TestAllTypes" does not have ' 'extensions.'), @@ -593,7 +593,7 @@ class Proto2Tests(TextFormatBase): message = unittest_pb2.TestAllExtensions() text = ('[protobuf_unittest.optional_int32_extension]: 42 ' '[protobuf_unittest.optional_int32_extension]: 67') - self.assertRaisesWithLiteralMatch( + self.assertRaisesRegexp( text_format.ParseError, ('1:96 : Message type "protobuf_unittest.TestAllExtensions" ' 'should not have multiple ' @@ -604,7 +604,7 @@ class Proto2Tests(TextFormatBase): message = unittest_pb2.TestAllTypes() text = ('optional_nested_message { bb: 1 } ' 'optional_nested_message { bb: 2 }') - self.assertRaisesWithLiteralMatch( + self.assertRaisesRegexp( text_format.ParseError, ('1:65 : Message type "protobuf_unittest.TestAllTypes.NestedMessage" ' 'should not have multiple "bb" fields.'), @@ -614,14 +614,14 @@ class Proto2Tests(TextFormatBase): message = unittest_pb2.TestAllTypes() text = ('optional_int32: 42 ' 'optional_int32: 67') - self.assertRaisesWithLiteralMatch( + self.assertRaisesRegexp( text_format.ParseError, ('1:36 : Message type "protobuf_unittest.TestAllTypes" should not ' 'have multiple "optional_int32" fields.'), text_format.Parse, text, message) -class TokenizerTest(basetest.TestCase): +class TokenizerTest(unittest.TestCase): def testSimpleTokenCases(self): text = ('identifier1:"string1"\n \n\n' @@ -766,4 +766,4 @@ class TokenizerTest(basetest.TestCase): if __name__ == '__main__': - basetest.main() + unittest.main() |