aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2015-10-04 12:17:10 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2015-10-04 12:17:10 -0500
commit583bd44cae66052412b2e976dd8d63fc671986eb (patch)
treedca9ffc4d0d1aa0c0beae9ad072f6b7cdf7598ff
parent4202ee3617e54bf541380629a7234e476fec894a (diff)
downloaduritemplates-583bd44cae66052412b2e976dd8d63fc671986eb.tar.gz
Clean up flake8 violations
-rw-r--r--test_from_uritemplatepy.py11
-rw-r--r--test_uritemplate.py8
-rw-r--r--uritemplate/variable.py2
3 files changed, 10 insertions, 11 deletions
diff --git a/test_from_uritemplatepy.py b/test_from_uritemplatepy.py
index 52b9a55..c48e46b 100644
--- a/test_from_uritemplatepy.py
+++ b/test_from_uritemplatepy.py
@@ -48,10 +48,10 @@ def python_safe_name(s):
def make_test(test_name, template, variables, expected):
def json_test_function(self):
actual = unicode(expand(template, variables))
- msg = '%(template)r did not expand as expected, got %(actual)r.'\
- % locals()
- if type(expected) == type([]):
- self.assertTrue (actual in expected, msg)
+ msg = ('%(template)r did not expand as expected, got %(actual)r.' %
+ locals())
+ if isinstance(expected, list):
+ self.assertTrue(actual in expected, msg)
else:
self.assertEqual(expected, actual)
json_test_function.__name__ = test_name
@@ -77,7 +77,7 @@ def build_tests_from_json(data_set, test_class=TestJSONFromUritemplatePy):
template = testcase[0]
expected = testcase[1]
# closure on the test params
- test_method = make_test(safe_name , template, variables, expected)
+ test_method = make_test(safe_name, template, variables, expected)
# attach that method to the class
setattr(test_class, safe_name, test_method)
@@ -187,6 +187,5 @@ class TestVariablesFromUritemplatePy(TestCase):
self.assertEquals(set(['a', 'b', 'c', 'd']), vrs)
-
if __name__ == '__main__':
main()
diff --git a/test_uritemplate.py b/test_uritemplate.py
index 756a9a6..26aeb72 100644
--- a/test_uritemplate.py
+++ b/test_uritemplate.py
@@ -21,7 +21,7 @@ class RFCTemplateExamples(type):
list_ex = {'list': ['red', 'green', 'blue']}
keys = {'keys': [('semi', ';'), ('dot', '.'), ('comma', ',')]}
- ## Level 1
+ # # Level 1
# Simple string expansion
level1_examples = {
'{var}': {
@@ -34,7 +34,7 @@ class RFCTemplateExamples(type):
},
}
- ## Level 2
+ # # Level 2
# Reserved string expansion
level2_reserved_examples = {
'{+var}': {
@@ -67,7 +67,7 @@ class RFCTemplateExamples(type):
},
}
- ## Level 3
+ # # Level 3
# String expansion with multiple variables
level3_multiple_variable_examples = {
'map?{x,y}': {
@@ -164,7 +164,7 @@ class RFCTemplateExamples(type):
}
}
- ## Level 4
+ # # Level 4
# String expansion with value modifiers
level4_value_modifier_examples = {
'{var:3}': {
diff --git a/uritemplate/variable.py b/uritemplate/variable.py
index 077ad21..a17c2e1 100644
--- a/uritemplate/variable.py
+++ b/uritemplate/variable.py
@@ -112,7 +112,7 @@ class URIVariable(object):
(name, {'explode': explode, 'prefix': prefix})
)
- self.variable_names = [name for (name, _) in self.variables]
+ self.variable_names = [varname for (varname, _) in self.variables]
def post_parse(self):
"""Set ``start``, ``join_str`` and ``safe`` attributes.