From 337f1cf7105a79008ca34b4105386a525c8d287f Mon Sep 17 00:00:00 2001 From: Daniel Roberts Date: Sun, 1 Sep 2013 20:03:26 -0400 Subject: [PATCH] fix tests for python 2.6 list.index has a different native error message in 2.6 and 2.7 --- tests/test_schema.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_schema.py b/tests/test_schema.py index 18242d6..42cf3c5 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -1140,7 +1140,6 @@ class B(Document): {'doc_type': 'A', 's': unicode(a2.s)}] }) - def testSchemaListPropertyIndex(self): """SchemaListProperty index method """ @@ -1164,8 +1163,10 @@ class B(Document): self.assertEqual(b.slm.index(a1, 1, -2), 2) with self.assertRaises(ValueError) as cm: b.slm.index(a3) - self.assertEqual(str(cm.exception), '{0} is not in list'.format(a3)) - + self.assertIn(str(cm.exception), ( + '{0!r} is not in list'.format(a3), + 'list.index(x): x not in list' + )) def testSchemaListPropertyInsert(self): """SchemaListProperty insert method @@ -1256,8 +1257,10 @@ class B(Document): }) with self.assertRaises(ValueError) as cm: b.slm.remove(a1) - self.assertEqual(str(cm.exception), '{0} is not in list'.format(a1)) - + self.assertIn(str(cm.exception), ( + '{0!r} is not in list'.format(a1), + 'list.index(x): x not in list' + )) def testSchemaListPropertyReverse(self): """SchemaListProperty reverse method