def test_delete_BaseModel(self): """test delete method of BaseModel""" new_base = BaseModel() new_base.save() countb = len(storage.all().keys()) new_base.delete() counta = len(storage.all().keys()) self.assertGreater(countb, counta)
def test_delete_in_fileStorage(self): """Test for method delete when using FileStorage """ storage = FileStorage() obj = BaseModel() storage.new(obj) self.assertTrue(obj in storage._FileStorage__objects.values()) obj.delete() self.assertTrue(obj not in storage._FileStorage__objects.values())
def test006(self): """ Check delete """ base = BaseModel() base.save() base.delete() self.assertEqual(1, 1)
#!/usr/bin/python3 from models.base_model import BaseModel my_model = BaseModel() my_model.name = "notrebloh" my_model.my_number = 89 print(my_model) print('\n\n\n') my_model.save() print(my_model) print('\n\n\n') my_model_json = my_model.to_json() print(my_model_json) print('\n\n\n') print("JSON of my_model:") print('\n\n\n') for key in my_model_json.keys(): print("\t{}: ({}) - {}".format(key, type(my_model_json[key]), my_model_json[key])) my_model.delete()