Пример #1
0
 def test_newark(self):
     weatherservice._USE_CLASSES = False
     report = weatherservice.get_report("newark, de")
     self.assertIsInstance(report, dict)
Пример #2
0
 def test_china(self):
     with self.assertRaises(weatherservice.GeocodeException):
         weatherservice.get_report("tokoyo, china")
Пример #3
0
 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)
Пример #4
0
 def test_newark(self):
     weatherservice._USE_CLASSES = False
     report = weatherservice.get_report("newark, de")
     self.assertIsInstance(report, dict)
Пример #5
0
 def test_china(self):
     with self.assertRaises(weatherservice.GeocodeException):
         weatherservice.get_report("tokoyo, china")
Пример #6
0
 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)