def repository_exist(name): try: Repository.get(Repository.name == name) except DoesNotExist: return False return True
def test_get(self): repository = Repository() tweet = Tweet("Le gras c'est la vie.") repository.add(tweet) self.assertEqual(tweet, repository.get(1)) self.assertIsNone(repository.get(2))