Update Flow::__str__

The current implementation seems a little cryptic so updating it
to clearly indicate the atom count.

Change-Id: I4f97e458a4b80e33b3d6348a3ef632398586ed47
This commit is contained in:
Manish Godara
2015-02-13 15:53:22 -08:00
parent 72a9c00625
commit 06ffceea77
4 changed files with 6 additions and 7 deletions

View File

@@ -96,9 +96,8 @@ class Flow(object):
"""
def __str__(self):
lines = ["%s: %s" % (reflection.get_class_name(self), self.name)]
lines.append("%s" % (len(self)))
return "; ".join(lines)
return "%s: %s(len=%d)" % (reflection.get_class_name(self),
self.name, len(self))
@property
def provides(self):

View File

@@ -37,7 +37,7 @@ class GraphFlowTest(test.TestCase):
self.assertEqual(f.requires, set())
self.assertEqual(f.provides, set())
expected = 'taskflow.patterns.graph_flow.Flow: test; 0'
expected = 'taskflow.patterns.graph_flow.Flow: test(len=0)'
self.assertEqual(str(f), expected)
def test_graph_flow_add_nothing(self):

View File

@@ -36,7 +36,7 @@ class LinearFlowTest(test.TestCase):
self.assertEqual(f.requires, set())
self.assertEqual(f.provides, set())
expected = 'taskflow.patterns.linear_flow.Flow: test; 0'
expected = 'taskflow.patterns.linear_flow.Flow: test(len=0)'
self.assertEqual(str(f), expected)
def test_linear_flow_add_nothing(self):
@@ -107,7 +107,7 @@ class LinearFlowTest(test.TestCase):
(task2, task3, {'invariant': True})
])
expected = 'taskflow.patterns.linear_flow.Flow: test; 3'
expected = 'taskflow.patterns.linear_flow.Flow: test(len=3)'
self.assertEqual(str(f), expected)
def test_linear_flow_with_retry(self):

View File

@@ -36,7 +36,7 @@ class UnorderedFlowTest(test.TestCase):
self.assertEqual(f.requires, set())
self.assertEqual(f.provides, set())
expected = 'taskflow.patterns.unordered_flow.Flow: test; 0'
expected = 'taskflow.patterns.unordered_flow.Flow: test(len=0)'
self.assertEqual(str(f), expected)
def test_unordered_flow_add_nothing(self):