Example #1
0
def test_check_positive():
    value = checkargs.check_positive(0)
    assert value == 0
Example #2
0
def test_check_positive_float():
    value = checkargs.check_positive(1.1)
    assert value == 1.1
Example #3
0
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)
Example #4
0
    def test_check_positive_float(self):
        value = checkargs.check_positive(1.1)

        self.assertEqual(value, 1.1)
Example #5
0
    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))
Example #6
0
    def test_check_positive(self):
        value = checkargs.check_positive(0)

        self.assertEqual(value, 0)