File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,7 +116,11 @@ def get_all(self) -> list:
116116 finally :
117117 obx_bytes_array_free (c_bytes_array_p )
118118
119- def remove (self , id : int ):
119+ def remove (self , id_or_object ):
120+ if isinstance (id_or_object , self ._entity .cls ):
121+ id = self ._entity .get_object_id (id_or_object )
122+ else :
123+ id = id_or_object
120124 obx_box_remove (self ._c_box , id )
121125
122126 def remove_all (self ) -> int :
Original file line number Diff line number Diff line change @@ -85,12 +85,15 @@ def test_box_basics():
8585 assert_equal (read , object )
8686
8787 # remove
88- box .remove (object .id )
88+ box .remove (object )
89+ box .remove (1 )
8990
90- # check it's missing
91- assert box .count () == 1
91+ # check they're gone
92+ assert box .count () == 0
9293 with pytest .raises (objectbox .NotFoundException ):
9394 box .get (object .id )
95+ with pytest .raises (objectbox .NotFoundException ):
96+ box .get (1 )
9497
9598
9699def test_box_bulk ():
You can’t perform that action at this time.
0 commit comments