def test_output(self, case): reference, formula, inputs, result = case dsp = sh.Dispatcher() cell = Cell(reference, formula).compile() assert cell.add(dsp) output = str(dsp(inputs)[cell.output]) self.assertEqual(result, output, '{} != {}'.format(result, output))
def test_invalid(self, case): reference, formula, inputs = case with self.assertRaises(sh.DispatcherError): dsp = sh.Dispatcher(raises=True) cell = Cell(reference, formula).compile() assert cell.add(dsp) dsp(inputs)
def test_impure(self, case): reference, formula, dt = case dsp = sh.Dispatcher() cell = Cell(reference, formula).compile() assert cell.add(dsp) out = str(dsp()[cell.output]) time.sleep(dt) self.assertNotEqual(out, str(dsp()[cell.output]))