def test_newark(self): weatherservice._USE_CLASSES = False report = weatherservice.get_report("newark, de") self.assertIsInstance(report, dict)
def test_china(self): with self.assertRaises(weatherservice.GeocodeException): weatherservice.get_report("tokoyo, china")
def test_cache(self): weatherservice._start_editing() weatherservice.get_report("newark, de") weatherservice.get_report("blacksburg, va") weatherservice.get_report("new york, NY") weatherservice.get_report("santa barbara, CA") weatherservice.get_report("san francisco, CA") self.assertEqual(len(weatherservice._CACHE), 27) weatherservice.get_report("san francisco, CA") weatherservice.get_report("san francisco, CA") weatherservice.get_report("san francisco, CA") self.assertEqual(sum([len(element) for key, element in weatherservice._CACHE.items()]), 67)
def test_cache(self): weatherservice._start_editing() weatherservice.get_report("newark, de") weatherservice.get_report("blacksburg, va") weatherservice.get_report("new york, NY") weatherservice.get_report("santa barbara, CA") weatherservice.get_report("san francisco, CA") self.assertEqual(len(weatherservice._CACHE), 27) weatherservice.get_report("san francisco, CA") weatherservice.get_report("san francisco, CA") weatherservice.get_report("san francisco, CA") self.assertEqual( sum([ len(element) for key, element in weatherservice._CACHE.items() ]), 67)