ran unittest2pytest

This commit is contained in:
Bastien Gérard
2019-08-30 16:13:30 +03:00
parent aa6ff8c84a
commit ac25f4b98b
46 changed files with 4247 additions and 4428 deletions

View File

@@ -2,6 +2,7 @@
from mongoengine import *
from tests.utils import MongoDBTestCase
import pytest
class TestIntField(MongoDBTestCase):
@@ -23,11 +24,14 @@ class TestIntField(MongoDBTestCase):
person.validate()
person.age = -1
self.assertRaises(ValidationError, person.validate)
with pytest.raises(ValidationError):
person.validate()
person.age = 120
self.assertRaises(ValidationError, person.validate)
with pytest.raises(ValidationError):
person.validate()
person.age = "ten"
self.assertRaises(ValidationError, person.validate)
with pytest.raises(ValidationError):
person.validate()
def test_ne_operator(self):
class TestDocument(Document):
@@ -38,5 +42,5 @@ class TestIntField(MongoDBTestCase):
TestDocument(int_fld=None).save()
TestDocument(int_fld=1).save()
self.assertEqual(1, TestDocument.objects(int_fld__ne=None).count())
self.assertEqual(1, TestDocument.objects(int_fld__ne=1).count())
assert 1 == TestDocument.objects(int_fld__ne=None).count()
assert 1 == TestDocument.objects(int_fld__ne=1).count()