def get_post(self, year, month, post_name): """ Return a complete Post object that matches the parameters. @param year: an integer year value for the year the post was published. """ key = jsonsdump([year, month, post_name]) results = self._return_view("post", key=key) if len(results): return self._row_to_post(results[0]) raise DataBaseError("No results found for this key.")
def test_json_parser(self): json_str = jsonsdump(self.SAMPLE_JSON) classy_json = ClassyJSONString(json_str) self.run_tests(classy_json)
def test_file_parser(self): json_str = jsonsdump(self.SAMPLE_JSON) json_file = StringIO(json_str) classy_json = ClassyJSONFile(json_file) self.run_tests(classy_json)