def check_ok_value(self, param, value): with Capturing() as output: cno = CheckNumericOutput(['echo "3"', '-W 12', '-C 10']) result = cno.num_repr(param) self.assertEqual(result, value) self.assertEqual(output.stdout(), [], 'there should be no stdout') self.assertEqual(output.stderr(), [], 'there should be no stderr')
def test_m_num_repr_str(self): cno = CheckNumericOutput(['echo "3"', '-W 12', '-C 10']) b = False try: with Capturing() as output: result = cno.num_repr('2') except TypeError as e: b = True self.assertTrue(b,'Str argument should rise TypeError') self.assertEqual(output.stdout(), [], 'there should be no stdout') self.assertEqual(output.stderr(), [], 'there should be no stderr')