Beispiel #1
0
    def test_done(self):
        saver = Saver()
        recipe = Recipe(saver)
        recipe.run([1])
        recipe.done()

        self.assertRaises(OvercookedError, recipe.run, [2])
        self.assertRaises(OvercookedError, recipe.done)
        self.assertEqual(saver.saved, [1])
Beispiel #2
0
    def test_error_stream(self):
        saver = Saver()
        recipe = Recipe(Raiser(), error_stream=saver)
        recipe.run([{'a': 1}, {'b': 2}])
        recipe.done()

        self.assertEqual(saver.saved[0]['record'], {'a': 1})
        self.assertEqual(saver.saved[1]['record'], {'b': 2})

        # Must pass either a Recipe, a Filter or an iterable of Filters
        # as the error_stream argument
        self.assertRaises(SaucebrushError, Recipe, error_stream=5)