def test_save(self): app = Application() app._contacts = [("NAME SURNAME", "3333")] try: os.unlink("./contacts.json") except FileNotFoundError: pass app.save() with open("./contacts.json") as f: assert json.load(f) == {"_contacts": [["NAME SURNAME", "3333"]]}
def test_loading(benchmark): app = Application() app._contacts = [(f"Name {n}", "number") for n in range(1000)] app.save() benchmark(app.load)