Finalize python2/3 codebase compatibility and get rid of 2to3
This commit is contained in:
		| @@ -1,4 +1,6 @@ | ||||
| # -*- coding: utf-8 -*- | ||||
| from builtins import str | ||||
|  | ||||
| import pytest | ||||
|  | ||||
| from mongoengine import ( | ||||
| @@ -75,7 +77,7 @@ class TestEmbeddedDocumentField(MongoDBTestCase): | ||||
|         # Test non exiting attribute | ||||
|         with pytest.raises(InvalidQueryError) as exc_info: | ||||
|             Person.objects(settings__notexist="bar").first() | ||||
|         assert unicode(exc_info.value) == u'Cannot resolve field "notexist"' | ||||
|         assert str(exc_info.value) == u'Cannot resolve field "notexist"' | ||||
|  | ||||
|         with pytest.raises(LookUpError): | ||||
|             Person.objects.only("settings.notexist") | ||||
| @@ -111,7 +113,7 @@ class TestEmbeddedDocumentField(MongoDBTestCase): | ||||
|         # Test non exiting attribute | ||||
|         with pytest.raises(InvalidQueryError) as exc_info: | ||||
|             assert Person.objects(settings__notexist="bar").first().id == p.id | ||||
|         assert unicode(exc_info.value) == u'Cannot resolve field "notexist"' | ||||
|         assert str(exc_info.value) == u'Cannot resolve field "notexist"' | ||||
|  | ||||
|         # Test existing attribute | ||||
|         assert Person.objects(settings__base_foo="basefoo").first().id == p.id | ||||
| @@ -319,7 +321,7 @@ class TestGenericEmbeddedDocumentField(MongoDBTestCase): | ||||
|         # Test non exiting attribute | ||||
|         with pytest.raises(InvalidQueryError) as exc_info: | ||||
|             Person.objects(settings__notexist="bar").first() | ||||
|         assert unicode(exc_info.value) == u'Cannot resolve field "notexist"' | ||||
|         assert str(exc_info.value) == u'Cannot resolve field "notexist"' | ||||
|  | ||||
|         with pytest.raises(LookUpError): | ||||
|             Person.objects.only("settings.notexist") | ||||
| @@ -347,7 +349,7 @@ class TestGenericEmbeddedDocumentField(MongoDBTestCase): | ||||
|         # Test non exiting attribute | ||||
|         with pytest.raises(InvalidQueryError) as exc_info: | ||||
|             assert Person.objects(settings__notexist="bar").first().id == p.id | ||||
|         assert unicode(exc_info.value) == u'Cannot resolve field "notexist"' | ||||
|         assert str(exc_info.value) == u'Cannot resolve field "notexist"' | ||||
|  | ||||
|         # Test existing attribute | ||||
|         assert Person.objects(settings__base_foo="basefoo").first().id == p.id | ||||
|   | ||||
		Reference in New Issue
	
	Block a user