Fix some issues related with db_field in constructor by removing field/db_field translation that shouldn't occur in constructor

This commit is contained in:
Bastien Gérard
2020-11-08 22:36:58 +01:00
parent eb56fb9bda
commit 8c3058d99b
3 changed files with 109 additions and 7 deletions

View File

@@ -2272,6 +2272,13 @@ class TestField(MongoDBTestCase):
with pytest.raises(FieldDoesNotExist):
Doc(bar="test")
def test_undefined_field_works_no_confusion_with_db_field(self):
class Doc(Document):
foo = StringField(db_field="bar")
with pytest.raises(FieldDoesNotExist):
Doc(bar="test")
class TestEmbeddedDocumentListField(MongoDBTestCase):
def setUp(self):