Fixes unsorted dicts and sets in doctests
A few doctests were checking the values of dictionaries and sets without sorting them in any way. This was causing some of the doctests to fail when the order inside the dictionary or set changed and wasn't consistent. Now all of the doctests check against sorted values so the tests are consistent in their output every time. Change-Id: I52b30327fb4acb3f1ee57ae14b611e988a43576a Closes-Bug: 1347937
This commit is contained in:
@@ -53,8 +53,8 @@ the task.
|
||||
... def execute(self, spam, eggs):
|
||||
... return spam + eggs
|
||||
...
|
||||
>>> MyTask().requires
|
||||
set(['eggs', 'spam'])
|
||||
>>> sorted(MyTask().requires)
|
||||
['eggs', 'spam']
|
||||
|
||||
Inference from the method signature is the ''simplest'' way to specify task
|
||||
arguments. Optional arguments (with default values), and special arguments like
|
||||
|
||||
@@ -34,6 +34,7 @@ set of names of such values is available via ``provides`` property of the flow.
|
||||
from taskflow import task
|
||||
from taskflow.patterns import linear_flow
|
||||
from taskflow import engines
|
||||
from pprint import pprint
|
||||
|
||||
For example:
|
||||
|
||||
@@ -118,10 +119,11 @@ of the engine helpers (:py:func:`~taskflow.engines.helpers.run` or
|
||||
>>> flo = linear_flow.Flow("cat-dog")
|
||||
>>> flo.add(CatTalk(), DogTalk(provides="dog"))
|
||||
<taskflow.patterns.linear_flow.Flow object at 0x...>
|
||||
>>> engines.run(flo, store={'meow': 'meow', 'woof': 'woof'})
|
||||
>>> result = engines.run(flo, store={'meow': 'meow', 'woof': 'woof'})
|
||||
meow
|
||||
woof
|
||||
{'meow': 'meow', 'woof': 'woof', 'dog': 'dog'}
|
||||
>>> pprint(result)
|
||||
{'dog': 'dog', 'meow': 'meow', 'woof': 'woof'}
|
||||
|
||||
You can also directly interact with the engine storage layer to add additional
|
||||
values, note that if this route is used you can't use
|
||||
@@ -154,8 +156,8 @@ For example:
|
||||
>>> eng.run()
|
||||
meow
|
||||
woof
|
||||
>>> print(eng.storage.fetch_all())
|
||||
{'meow': 'meow', 'woof': 'woof', 'dog': 'dog'}
|
||||
>>> pprint(eng.storage.fetch_all())
|
||||
{'dog': 'dog', 'meow': 'meow', 'woof': 'woof'}
|
||||
>>> print(eng.storage.fetch("dog"))
|
||||
dog
|
||||
|
||||
|
||||
Reference in New Issue
Block a user