Skip to content

Commit

Permalink
fix remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Caylo committed Jul 15, 2015
1 parent e0511f3 commit 6d7f123
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/framework/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -1269,9 +1269,11 @@ def test_dump_template(self):

def test_to_template_str(self):
""" Test for to_template_str method """

# reverse dict of known template constants; template values (which are keys here) must be 'string-in-string
templ_const = {
quote_py_str('template'):'TEMPLATE_VALUE',
quote_py_str('%(name)s-%(version)s'): 'NAME_VERSION',
"'template'":'TEMPLATE_VALUE',
"'%(name)s-%(version)s'": 'NAME_VERSION',
}

templ_val = {
Expand All @@ -1283,8 +1285,10 @@ def test_to_template_str(self):
self.assertEqual(to_template_str("template", templ_const, templ_val), 'TEMPLATE_VALUE')
self.assertEqual(to_template_str("foo/bar/0.0.1/", templ_const, templ_val), "'%(name)s/bar/%(version)s/'")
self.assertEqual(to_template_str("foo-0.0.1", templ_const, templ_val), 'NAME_VERSION')
self.assertEqual(to_template_str(['-test', 'dontreplacenamehere'], templ_const, templ_val), "['%(special_char)s', 'dontreplacenamehere']")
self.assertEqual(to_template_str({'a':'foo', 'b':'notemplate'}, templ_const, templ_val), "{'a': '%(name)s', 'b': 'notemplate'}")
templ_list = to_template_str(['-test', 'dontreplacenamehere'], templ_const, templ_val)
self.assertEqual(templ_list, "['%(special_char)s', 'dontreplacenamehere']")
templ_dict = to_template_str({'a':'foo', 'b':'notemplate'}, templ_const, templ_val)
self.assertEqual(templ_dict, "{'a': '%(name)s', 'b': 'notemplate'}")
self.assertEqual(to_template_str(('foo', '0.0.1'), templ_const, templ_val), "('%(name)s', '%(version)s')")


Expand Down

0 comments on commit 6d7f123

Please sign in to comment.