File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -557,6 +557,28 @@ class Foo(Document):
557557 except Exception :
558558 self .assertFalse ("Threw wrong exception" )
559559
560+ def test_reload_of_non_strict_with_special_field_name (self ):
561+ """Ensures reloading works for documents with meta strict == False
562+ """
563+ class Post (Document ):
564+ meta = {
565+ 'strict' : False
566+ }
567+ title = StringField ()
568+ items = ListField ()
569+
570+ Post .drop_collection ()
571+
572+ Post ._get_collection ().insert_one ({
573+ "title" : "Items eclipse" ,
574+ "items" : ["more lorem" , "even more ipsum" ]
575+ })
576+
577+ post = Post .objects .first ()
578+ post .reload ()
579+ self .assertEqual (post .title , "Items eclipse" )
580+ self .assertEqual (post .items , ["more lorem" , "even more ipsum" ])
581+
560582 def test_dictionary_access (self ):
561583 """Ensure that dictionary-style field access works properly.
562584 """
You can’t perform that action at this time.
0 commit comments