Permalink
Browse files

Minor tinman.application cleanups

  • Loading branch information...
1 parent 4855a3a commit daf303ec78681370b30764e3c810d00904c0a02f Gavin M. Roy committed Jun 30, 2012
Showing with 11 additions and 24 deletions.
  1. +2 −10 tests/application_test.py
  2. +9 −14 tinman/application.py
View
12 tests/application_test.py
@@ -13,24 +13,16 @@
class ApplicationTests(unittest.TestCase):
def setUp(self):
-
self._mock_obj = mock.Mock(spec=application.TinmanApplication)
-
def test_load_translations(self):
-
with mock.patch('tornado.locale.load_translations') as mock_load:
-
-
path = '/foo'
- print application.TinmanApplication._load_translations(self._mock_obj, path)
+ application.TinmanApplication._load_translations(self._mock_obj,
+ path)
mock_load.assert_called_once_with(path)
-
-
-
-
class AttributeTests(unittest.TestCase):
def test_add_attribute_exists(self):
View
23 tinman/application.py
@@ -120,26 +120,21 @@ def _prepare_paths(self):
def _replace_path(self, path_name, name, value):
"""Replace the name with the value for the given path_name name.
- :param path_name: The path_name name
- :type path_name: str
- :param name: The string to replace in original string
- :type name: str
- :param value: The string value replacement value for name
- :type value: str
+ :param str path_name: The path_name name
+ :param str name: The string to replace in original string
+ :param str value: The string value replacement value for name
"""
# If we have a base path_name, replace it if needed
- if self._settings[path_name]:
+ if path_name in self._settings:
self._settings[path_name] = self._settings[path_name].replace(name,
value)
def _set_path(self, path_name, path_value):
"""Set the specified path setting with the given value
- :param path_name: The path to set
- :type path_name: str
- :param path_value: Path to set it to
- :type path_value: str
+ :param str path_name: The path to set
+ :param str path_value: Path to set it to
"""
self._settings[path_name] = path_value
@@ -148,9 +143,9 @@ def _prepare_route(self, attributes):
"""Take a given inbound list for a route and parse it creating the
route and importing the class it belongs to.
- :param attributes: Route attributes
- :type attributes: list or tuple
- :rtype: list of prepared route
+ :param list attributes: Route attributes
+ :rtype: list
+
"""
# Validate it's a list or set
if type(attributes) not in (list, tuple):

0 comments on commit daf303e

Please sign in to comment.