|
|
|
@ -9,27 +9,27 @@ class BytesPartitionTest(testlib.TestCase):
|
|
|
|
|
|
|
|
|
|
def test_no_sep(self):
|
|
|
|
|
left, sep, right = self.func(b('dave'), b('x'))
|
|
|
|
|
self.assertTrue(isinstance(left, mitogen.core.BytesType))
|
|
|
|
|
self.assertTrue(isinstance(sep, mitogen.core.BytesType))
|
|
|
|
|
self.assertTrue(isinstance(right, mitogen.core.BytesType))
|
|
|
|
|
self.assertIsInstance(left, mitogen.core.BytesType)
|
|
|
|
|
self.assertIsInstance(sep, mitogen.core.BytesType)
|
|
|
|
|
self.assertIsInstance(right, mitogen.core.BytesType)
|
|
|
|
|
self.assertEqual(left, b('dave'))
|
|
|
|
|
self.assertEqual(sep, b(''))
|
|
|
|
|
self.assertEqual(right, b(''))
|
|
|
|
|
|
|
|
|
|
def test_one_sep(self):
|
|
|
|
|
left, sep, right = self.func(b('davexdave'), b('x'))
|
|
|
|
|
self.assertTrue(isinstance(left, mitogen.core.BytesType))
|
|
|
|
|
self.assertTrue(isinstance(sep, mitogen.core.BytesType))
|
|
|
|
|
self.assertTrue(isinstance(right, mitogen.core.BytesType))
|
|
|
|
|
self.assertIsInstance(left, mitogen.core.BytesType)
|
|
|
|
|
self.assertIsInstance(sep, mitogen.core.BytesType)
|
|
|
|
|
self.assertIsInstance(right, mitogen.core.BytesType)
|
|
|
|
|
self.assertEqual(left, b('dave'))
|
|
|
|
|
self.assertEqual(sep, b('x'))
|
|
|
|
|
self.assertEqual(right, b('dave'))
|
|
|
|
|
|
|
|
|
|
def test_two_seps(self):
|
|
|
|
|
left, sep, right = self.func(b('davexdavexdave'), b('x'))
|
|
|
|
|
self.assertTrue(isinstance(left, mitogen.core.BytesType))
|
|
|
|
|
self.assertTrue(isinstance(sep, mitogen.core.BytesType))
|
|
|
|
|
self.assertTrue(isinstance(right, mitogen.core.BytesType))
|
|
|
|
|
self.assertIsInstance(left, mitogen.core.BytesType)
|
|
|
|
|
self.assertIsInstance(sep, mitogen.core.BytesType)
|
|
|
|
|
self.assertIsInstance(right, mitogen.core.BytesType)
|
|
|
|
|
self.assertEqual(left, b('dave'))
|
|
|
|
|
self.assertEqual(sep, b('x'))
|
|
|
|
|
self.assertEqual(right, b('davexdave'))
|
|
|
|
@ -40,27 +40,27 @@ class StrPartitionTest(testlib.TestCase):
|
|
|
|
|
|
|
|
|
|
def test_no_sep(self):
|
|
|
|
|
left, sep, right = self.func(u'dave', u'x')
|
|
|
|
|
self.assertTrue(isinstance(left, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertTrue(isinstance(sep, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertTrue(isinstance(right, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertIsInstance(left, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertIsInstance(sep, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertIsInstance(right, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertEqual(left, u'dave')
|
|
|
|
|
self.assertEqual(sep, u'')
|
|
|
|
|
self.assertEqual(right, u'')
|
|
|
|
|
|
|
|
|
|
def test_one_sep(self):
|
|
|
|
|
left, sep, right = self.func(u'davexdave', u'x')
|
|
|
|
|
self.assertTrue(isinstance(left, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertTrue(isinstance(sep, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertTrue(isinstance(right, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertIsInstance(left, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertIsInstance(sep, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertIsInstance(right, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertEqual(left, u'dave')
|
|
|
|
|
self.assertEqual(sep, u'x')
|
|
|
|
|
self.assertEqual(right, u'dave')
|
|
|
|
|
|
|
|
|
|
def test_two_seps(self):
|
|
|
|
|
left, sep, right = self.func(u'davexdavexdave', u'x')
|
|
|
|
|
self.assertTrue(isinstance(left, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertTrue(isinstance(sep, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertTrue(isinstance(right, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertIsInstance(left, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertIsInstance(sep, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertIsInstance(right, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertEqual(left, u'dave')
|
|
|
|
|
self.assertEqual(sep, u'x')
|
|
|
|
|
self.assertEqual(right, u'davexdave')
|
|
|
|
@ -71,27 +71,27 @@ class StrRpartitionTest(testlib.TestCase):
|
|
|
|
|
|
|
|
|
|
def test_no_sep(self):
|
|
|
|
|
left, sep, right = self.func(u'dave', u'x')
|
|
|
|
|
self.assertTrue(isinstance(left, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertTrue(isinstance(sep, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertTrue(isinstance(right, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertIsInstance(left, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertIsInstance(sep, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertIsInstance(right, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertEqual(left, u'')
|
|
|
|
|
self.assertEqual(sep, u'')
|
|
|
|
|
self.assertEqual(right, u'dave')
|
|
|
|
|
|
|
|
|
|
def test_one_sep(self):
|
|
|
|
|
left, sep, right = self.func(u'davexdave', u'x')
|
|
|
|
|
self.assertTrue(isinstance(left, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertTrue(isinstance(sep, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertTrue(isinstance(right, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertIsInstance(left, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertIsInstance(sep, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertIsInstance(right, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertEqual(left, u'dave')
|
|
|
|
|
self.assertEqual(sep, u'x')
|
|
|
|
|
self.assertEqual(right, u'dave')
|
|
|
|
|
|
|
|
|
|
def test_two_seps(self):
|
|
|
|
|
left, sep, right = self.func(u'davexdavexdave', u'x')
|
|
|
|
|
self.assertTrue(isinstance(left, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertTrue(isinstance(sep, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertTrue(isinstance(right, mitogen.core.UnicodeType))
|
|
|
|
|
self.assertIsInstance(left, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertIsInstance(sep, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertIsInstance(right, mitogen.core.UnicodeType)
|
|
|
|
|
self.assertEqual(left, u'davexdave')
|
|
|
|
|
self.assertEqual(sep, u'x')
|
|
|
|
|
self.assertEqual(right, u'dave')
|
|
|
|
|