def test_check_positive(): value = checkargs.check_positive(0) assert value == 0
def test_check_positive_float(): value = checkargs.check_positive(1.1) assert value == 1.1
def test_check_positive_exception(): with pytest.raises(argparse.ArgumentTypeError) as context: checkargs.check_positive(-1) assert '-1 is an invalid positive value' in str(context)
def test_check_positive_float(self): value = checkargs.check_positive(1.1) self.assertEqual(value, 1.1)
def test_check_positive_exception(self): with self.assertRaises(argparse.ArgumentTypeError) as context: checkargs.check_positive(-1) self.assertTrue('-1 is an invalid positive value' in str(context.exception))
def test_check_positive(self): value = checkargs.check_positive(0) self.assertEqual(value, 0)