Пример #1
0
    def test_positive_int(self):
        assert 1 == cli_parser.positive_int(allow_zero=True)('1')
        assert 0 == cli_parser.positive_int(allow_zero=True)('0')

        with pytest.raises(argparse.ArgumentTypeError):
            cli_parser.positive_int(allow_zero=False)('0')
            cli_parser.positive_int(allow_zero=True)('-1')
Пример #2
0
    def test_positive_int(self):
        self.assertEqual(1, cli_parser.positive_int('1'))

        with self.assertRaises(argparse.ArgumentTypeError):
            cli_parser.positive_int('0')
            cli_parser.positive_int('-1')
Пример #3
0
    def test_positive_int(self):
        assert 1 == cli_parser.positive_int('1')

        with pytest.raises(argparse.ArgumentTypeError):
            cli_parser.positive_int('0')
            cli_parser.positive_int('-1')