Commit 697e21b8 by Danielle Madeley

Python 2.6 compatible format usage

parent 0d9dcb4d
...@@ -28,7 +28,7 @@ def open_file(filename): ...@@ -28,7 +28,7 @@ def open_file(filename):
this is not a context manager because it is used asynchronously by this is not a context manager because it is used asynchronously by
hooks hooks
out of the scope of enable() because we want to patch it in our tests out of the scope of enable() because we want to patch it in our tests
""" """
...@@ -113,7 +113,9 @@ def enable(filename=None): ...@@ -113,7 +113,9 @@ def enable(filename=None):
else: else:
raise AssertionError("Internal error") raise AssertionError("Internal error")
steps = u'{} {}\n'.format(marker, step.sentence) steps = u'{marker} {sentence}\n'.format(
marker=marker,
sentence=step.sentence)
streamresult.status(test_id=get_test_id(step.scenario), streamresult.status(test_id=get_test_id(step.scenario),
file_name='steps', file_name='steps',
file_bytes=steps.encode('utf-8'), file_bytes=steps.encode('utf-8'),
...@@ -127,4 +129,6 @@ def enable(filename=None): ...@@ -127,4 +129,6 @@ def enable(filename=None):
def get_test_id(scenario): def get_test_id(scenario):
return '{}: {}'.format(scenario.feature.name, scenario.name) return '{feature}: {scenario}'.format(
feature=scenario.feature.name,
scenario=scenario.name)
...@@ -36,7 +36,9 @@ class Includes(object): ...@@ -36,7 +36,9 @@ class Includes(object):
return all((v == a[k] for k, v in self.d.iteritems())) return all((v == a[k] for k, v in self.d.iteritems()))
def __repr__(self): def __repr__(self):
return '{}({})'.format(self.__class__.__name__, self.d) return '{klass}({d})'.format(
klass=self.__class__.__name__,
d=self.d)
class Keys(object): class Keys(object):
...@@ -57,7 +59,9 @@ class ContentContains(object): ...@@ -57,7 +59,9 @@ class ContentContains(object):
return self.text in a.as_text() return self.text in a.as_text()
def __repr__(self): def __repr__(self):
return '{}({})'.format(self.__class__.__name__, self.text) return '{klass}({text})'.format(
klass=self.__class__.__name__,
text=self.text)
class State(object): class State(object):
...@@ -68,7 +72,7 @@ class State(object): ...@@ -68,7 +72,7 @@ class State(object):
try: try:
d = self.expect.pop(0) d = self.expect.pop(0)
except IndexError: except IndexError:
raise AssertionError("Unexpected {}".format(test)) raise AssertionError("Unexpected {test}".format(test=test))
assert_equal(d, test) assert_equal(d, test)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment