ran unittest2pytest
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user