Finalize python2/3 codebase compatibility and get rid of 2to3

This commit is contained in:
Bastien Gérard
2019-06-14 23:30:01 +02:00
parent 4d6ddb070e
commit 2ca905b6e5
11 changed files with 31 additions and 38 deletions

View File

@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
import pytest
from builtins import str
from mongoengine import *
from tests.utils import MongoDBTestCase
@@ -35,9 +37,8 @@ class TestURLField(MongoDBTestCase):
with pytest.raises(ValidationError) as exc_info:
link.validate()
assert (
unicode(exc_info.value)
== u"ValidationError (Link:None) (Invalid URL: http://\u043f\u0440\u0438\u0432\u0435\u0442.com: ['url'])"
)
str(exc_info.exception)
== u"ValidationError (Link:None) (Invalid URL: http://\u043f\u0440\u0438\u0432\u0435\u0442.com: ['url'])")
def test_url_scheme_validation(self):
"""Ensure that URLFields validate urls with specific schemes properly.