def test_all_Place(self): """ test for all() method in all classnames """ self.kill() self.assertEqual(storage.all(), {}) # check that file.json is empty obj = storage.tester()["Place"]() storage.new(obj) key = "{}.{}".format(type(obj).__name__, obj.id) self.assertTrue(key in storage.all()) self.assertEqual(storage.all()[key], obj)
def test_re_objs_Amenity(self): """ test for all() method in all classnames with many objects """ self.kill() self.assertEqual(storage.all(), {}) # check that file.json is empty cl = storage.tester()["Amenity"] objs = [cl() for i in range(7000)] [storage.new(obj) for obj in objs] self.assertEqual(len(objs), len(storage.all())) # check if create 7000 objs for obj in objs: key = "{}.{}".format(type(obj).__name__, obj.id) self.assertTrue(key in storage.all()) self.assertEqual(storage.all()[key], obj)