def testDictOutput(self): outputs = {"x": 1, "y": 2} self.assertEquals(module._prepare_outputs(outputs, as_dict=True), outputs) with self.assertRaisesRegexp(TypeError, r"Use as_dict=True."): self.assertEquals(module._prepare_outputs(outputs, as_dict=False), outputs)
def testOutputWithDefault(self): outputs = {"default": "result", "extra": "dbg info"} self.assertEquals(module._prepare_outputs(outputs, as_dict=False), "result") self.assertEquals(module._prepare_outputs(outputs, as_dict=True), outputs)