@@ -65,12 +65,12 @@ def tearDown(self):
6565 for collection in list_collection_names (self .db ):
6666 self .db .drop_collection (collection )
6767
68- def assertDbEqual (self , docs ):
68+ def _assert_db_equal (self , docs ):
6969 assert list (self .Person ._get_collection ().find ().sort ("id" )) == sorted (
7070 docs , key = lambda doc : doc ["_id" ]
7171 )
7272
73- def assertHasInstance (self , field , instance ):
73+ def _assert_has_instance (self , field , instance ):
7474 assert hasattr (field , "_instance" )
7575 assert field ._instance is not None
7676 if isinstance (field ._instance , weakref .ProxyType ):
@@ -740,11 +740,11 @@ class Doc(Document):
740740 Doc .drop_collection ()
741741
742742 doc = Doc (embedded_field = Embedded (string = "Hi" ))
743- self .assertHasInstance (doc .embedded_field , doc )
743+ self ._assert_has_instance (doc .embedded_field , doc )
744744
745745 doc .save ()
746746 doc = Doc .objects .get ()
747- self .assertHasInstance (doc .embedded_field , doc )
747+ self ._assert_has_instance (doc .embedded_field , doc )
748748
749749 def test_embedded_document_complex_instance (self ):
750750 """Ensure that embedded documents in complex fields can reference
@@ -759,11 +759,11 @@ class Doc(Document):
759759
760760 Doc .drop_collection ()
761761 doc = Doc (embedded_field = [Embedded (string = "Hi" )])
762- self .assertHasInstance (doc .embedded_field [0 ], doc )
762+ self ._assert_has_instance (doc .embedded_field [0 ], doc )
763763
764764 doc .save ()
765765 doc = Doc .objects .get ()
766- self .assertHasInstance (doc .embedded_field [0 ], doc )
766+ self ._assert_has_instance (doc .embedded_field [0 ], doc )
767767
768768 def test_embedded_document_complex_instance_no_use_db_field (self ):
769769 """Ensure that use_db_field is propagated to list of Emb Docs."""
@@ -792,11 +792,11 @@ class Account(Document):
792792
793793 acc = Account ()
794794 acc .email = Email (email = "test@example.com" )
795- self .assertHasInstance (acc ._data ["email" ], acc )
795+ self ._assert_has_instance (acc ._data ["email" ], acc )
796796 acc .save ()
797797
798798 acc1 = Account .objects .first ()
799- self .assertHasInstance (acc1 ._data ["email" ], acc1 )
799+ self ._assert_has_instance (acc1 ._data ["email" ], acc1 )
800800
801801 def test_instance_is_set_on_setattr_on_embedded_document_list (self ):
802802 class Email (EmbeddedDocument ):
@@ -808,11 +808,11 @@ class Account(Document):
808808 Account .drop_collection ()
809809 acc = Account ()
810810 acc .emails = [Email (email = "test@example.com" )]
811- self .assertHasInstance (acc ._data ["emails" ][0 ], acc )
811+ self ._assert_has_instance (acc ._data ["emails" ][0 ], acc )
812812 acc .save ()
813813
814814 acc1 = Account .objects .first ()
815- self .assertHasInstance (acc1 ._data ["emails" ][0 ], acc1 )
815+ self ._assert_has_instance (acc1 ._data ["emails" ][0 ], acc1 )
816816
817817 def test_save_checks_that_clean_is_called (self ):
818818 class CustomError (Exception ):
@@ -921,7 +921,7 @@ def test_modify_empty(self):
921921 with pytest .raises (InvalidDocumentError ):
922922 self .Person ().modify (set__age = 10 )
923923
924- self .assertDbEqual ([dict (doc .to_mongo ())])
924+ self ._assert_db_equal ([dict (doc .to_mongo ())])
925925
926926 def test_modify_invalid_query (self ):
927927 doc1 = self .Person (name = "bob" , age = 10 ).save ()
@@ -931,7 +931,7 @@ def test_modify_invalid_query(self):
931931 with pytest .raises (InvalidQueryError ):
932932 doc1 .modify ({"id" : doc2 .id }, set__value = 20 )
933933
934- self .assertDbEqual (docs )
934+ self ._assert_db_equal (docs )
935935
936936 def test_modify_match_another_document (self ):
937937 doc1 = self .Person (name = "bob" , age = 10 ).save ()
@@ -941,7 +941,7 @@ def test_modify_match_another_document(self):
941941 n_modified = doc1 .modify ({"name" : doc2 .name }, set__age = 100 )
942942 assert n_modified == 0
943943
944- self .assertDbEqual (docs )
944+ self ._assert_db_equal (docs )
945945
946946 def test_modify_not_exists (self ):
947947 doc1 = self .Person (name = "bob" , age = 10 ).save ()
@@ -951,7 +951,7 @@ def test_modify_not_exists(self):
951951 n_modified = doc2 .modify ({"name" : doc2 .name }, set__age = 100 )
952952 assert n_modified == 0
953953
954- self .assertDbEqual (docs )
954+ self ._assert_db_equal (docs )
955955
956956 def test_modify_update (self ):
957957 other_doc = self .Person (name = "bob" , age = 10 ).save ()
@@ -977,7 +977,7 @@ def test_modify_update(self):
977977 assert doc .to_json () == doc_copy .to_json ()
978978 assert doc ._get_changed_fields () == []
979979
980- self .assertDbEqual ([dict (other_doc .to_mongo ()), dict (doc .to_mongo ())])
980+ self ._assert_db_equal ([dict (other_doc .to_mongo ()), dict (doc .to_mongo ())])
981981
982982 def test_modify_with_positional_push (self ):
983983 class Content (EmbeddedDocument ):
0 commit comments