- def testWeatherSetLocation(self):
- """Tests the location setting of the weather module"""
- self.weather.set_location('Bradford,England')
- self.assertEqual(self.weather.get_location(), 'Bradford,England')
-
def testWeatherLocationLatinEncoding(self):
"""Tests whether code can handle Latin-1 encoding back from google"""
#Check for Montreal which gets info back from google in Latin-1
- self.weather.set_location("Montreal")
+ self.weather.location = "Montreal" self.weather.refresh()
results = self.weather.get_forecasts()
#if there are results then it's working self.assertTrue(len(results) > 0)
def test_yuma_conditions(self):
- """Tests that there's no 'weather-na' in Yuma"""
+ """Tests that there's no 'weather-na' in Yuma."""
# Here we expect sun http://en.wikipedia.org/wiki/Yuma,_Arizona.
# `Yuma is the sunniest place on earth` (90% of the time)
- self.weather.set_location("Yuma")
+ self.weather.location = "Yuma" self.weather.refresh()
forecasts = self.weather.get_forecasts()
for day in forecasts: self.assertFalse(day["Image"] == 'weather-na')
def test_london_conditions(self):
- """Tests that there's no 'weather-na' in London"""
- self.weather.set_location("London")
+ """Tests that there's no 'weather-na' in London."""
+ self.weather.location = "London" self.weather.refresh()
forecasts = self.weather.get_forecasts()
for day in forecasts: self.assertFalse(day["Image"] == 'weather-na')
def test_perth_conditions(self):
- """Tests that there's no 'weather-na' in Perth"""
- self.weather.set_location("Perth")
+ """Tests that there's no 'weather-na' in Perth."""
+ self.weather.location = "Perth" self.weather.refresh()
forecasts = self.weather.get_forecasts()
for day in forecasts: self.assertFalse(day["Image"] == 'weather-na')
def test_nyc_conditions(self):
- """Tests that there's no 'weather-na' in New York"""
- self.weather.set_location("New York")
+ """Tests that there's no 'weather-na' in New York."""
+ self.weather.location = "New York" self.weather.refresh()
forecasts = self.weather.get_forecasts()
for day in forecasts: self.assertFalse(day["Image"] == 'weather-na')
def test_north_pole_conditions(self):
- """Tests that there's no 'weather-na' in North Pole"""
- self.weather.set_location("North Pole")
+ """Tests that there's no 'weather-na' in North Pole."""
+ self.weather.location = "North Pole" self.weather.refresh()
forecasts = self.weather.get_forecasts()
for day in forecasts:
- def set_location(self, location):
- """Sets the current location."""
- self._location = location
-
- def get_location(self):
- """Gets the current location."""
- return self._location
-
def clear_forecasts(self):
"""Resets the forecast array.""" self._forecasts = []
@@ -149,7 +140,7 @@
def refresh(self):
"""Clear current weather and forecasts and then loads new data."""
- if (self._location):
+ if self.location: self.clear_forecasts()
- self.find_forecast(self._location)
+ self.find_forecast(self.location)
Matt,
Branch updated an pushed.
incremental diff :
=== modified file 'entertainerlib /frontend/ gui/screens/ weather. py' frontend/ gui/screens/ weather. py 2009-05-09 17:03:51 +0000 frontend/ gui/screens/ weather. py 2009-05-25 16:43:06 +0000
screen_ title = Label(0.13, "screentitle", 0, 0.87, _("Weather"))
self. add(screen_ title)
--- entertainerlib/
+++ entertainerlib/
@@ -20,11 +20,11 @@
- if (self.weather. get_location( ) == ''): location == ''):
self. add(Label( 0.04167, "text", 0.30, 0.20,
_("No weather location defined!"), font_weight= "bold") ) get_location( ) location
+ if (self.weather.
else:
- location_text = self.weather.
+ location_text = self.weather.
=== modified file 'entertainerlib /tests/ test_weather. py' tests/test_ weather. py 2009-05-23 21:08:16 +0000 tests/test_ weather. py 2009-05-25 16:46:12 +0000
return ZERO
--- entertainerlib/
+++ entertainerlib/
@@ -74,7 +74,7 @@
england = EnglandTimeZone()
- self.weather. set_location( 'Bath,England' ) location = 'Bath,England'
self. weather. refresh( ) get_forecasts( )
self. assertEqual( today[" High"], 20)
self. assertEqual( today[" Condition" ],"Sunny" )
+ self.weather.
forecasts = self.weather.
today = forecasts[0]
@@ -93,57 +93,52 @@
- def testWeatherSetL ocation( self): set_location( 'Bradford, England' ) l(self. weather. get_location( ), 'Bradford,England') tionLatinEncodi ng(self) : set_location( "Montreal" ) location = "Montreal"
self. weather. refresh( ) get_forecasts( )
self. assertTrue( len(results) > 0)
- """Tests the location setting of the weather module"""
- self.weather.
- self.assertEqua
-
def testWeatherLoca
"""Tests whether code can handle Latin-1 encoding back from google"""
#Check for Montreal which gets info back from google in Latin-1
- self.weather.
+ self.weather.
results = self.weather.
#if there are results then it's working
def test_yuma_ conditions( self): en.wikipedia. org/wiki/ Yuma,_Arizona. set_location( "Yuma") location = "Yuma"
self. weather. refresh( ) get_forecasts( )
self. assertFalse( day["Image" ] == 'weather-na')
- """Tests that there's no 'weather-na' in Yuma"""
+ """Tests that there's no 'weather-na' in Yuma."""
# Here we expect sun http://
# `Yuma is the sunniest place on earth` (90% of the time)
- self.weather.
+ self.weather.
forecasts = self.weather.
for day in forecasts:
def test_london_ conditions( self): set_location( "London" ) location = "London"
self. weather. refresh( ) get_forecasts( )
self. assertFalse( day["Image" ] == 'weather-na')
- """Tests that there's no 'weather-na' in London"""
- self.weather.
+ """Tests that there's no 'weather-na' in London."""
+ self.weather.
forecasts = self.weather.
for day in forecasts:
def test_perth_ conditions( self): set_location( "Perth" ) location = "Perth"
self. weather. refresh( ) get_forecasts( )
self. assertFalse( day["Image" ] == 'weather-na')
- """Tests that there's no 'weather-na' in Perth"""
- self.weather.
+ """Tests that there's no 'weather-na' in Perth."""
+ self.weather.
forecasts = self.weather.
for day in forecasts:
def test_nyc_ conditions( self): set_location( "New York") location = "New York"
self. weather. refresh( ) get_forecasts( )
self. assertFalse( day["Image" ] == 'weather-na')
- """Tests that there's no 'weather-na' in New York"""
- self.weather.
+ """Tests that there's no 'weather-na' in New York."""
+ self.weather.
forecasts = self.weather.
for day in forecasts:
def test_north_ pole_conditions (self): set_location( "North Pole") location = "North Pole"
self. weather. refresh( ) get_forecasts( )
- """Tests that there's no 'weather-na' in North Pole"""
- self.weather.
+ """Tests that there's no 'weather-na' in North Pole."""
+ self.weather.
forecasts = self.weather.
for day in forecasts:
=== modified file 'entertainerlib /utils/ content_ management_ dialog. py' utils/content_ management_ dialog. py 2009-05-06 02:58:08 +0000 utils/content_ management_ dialog. py 2009-05-25 16:54:32 +0000 list.get_ model()
model. clear() set_location( search_ term) location = search_term
self. weather. refresh( )
results = self.weather. get_forecasts( )
--- entertainerlib/
+++ entertainerlib/
@@ -484,7 +484,7 @@
model = result_
if search_term != "":
- self.weather.
+ self.weather.
if len(results) > 0:
=== modified file 'entertainerlib /utils/ weather. py' utils/weather. py 2009-05-23 21:08:16 +0000 utils/weather. py 2009-05-25 16:41:29 +0000
--- entertainerlib/
+++ entertainerlib/
@@ -32,10 +32,9 @@
"""
def __init__(self, location=""):
self. _forecasts = [] ).theme location( location)
self. locale = self._get_locale()
self. refresh( )
- self._location = ''
+ self.location = location
self.theme = Configuration(
- self.set_
@@ -116,14 +115,6 @@
return self._forecasts
- def set_location(self, location): (self):
self. _forecasts = []
- """Sets the current location."""
- self._location = location
-
- def get_location(self):
- """Gets the current location."""
- return self._location
-
def clear_forecasts
"""Resets the forecast array."""
@@ -149,7 +140,7 @@
def refresh(self):
self. clear_forecasts () forecast( self._location) forecast( self.location)
"""Clear current weather and forecasts and then loads new data."""
- if (self._location):
+ if self.location:
- self.find_
+ self.find_
Samuel-