How to use the b2sdk.parse_args.parse_arg_list function in b2sdk

To help you get started, we’ve selected a few b2sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Backblaze / b2-sdk-python / test / test_parse_args.py View on Github external
def test_no_optional(self):
        args = parse_arg_list(['a'], **self.BEFORE_AND_AFTER)
        self.assertEqual((None, 'a', None), (args.optionalBefore, args.required, args.optional))
github Backblaze / b2-sdk-python / test / test_parse_args.py View on Github external
def test_all_there(self):
        args = parse_arg_list(
            ['--optionFlag', '--optionArg', '99', '--list', '1', '--list', '2', 'b', 'c'],
            **self.EVERYTHING
        )  # yapf disable
        self.assertTrue(args.optionFlag)
        self.assertEqual(99, args.optionArg)
        self.assertEqual('b', args.required)
        self.assertEqual(['1', '2'], args.list)
        self.assertEqual('c', args.optional)
github Backblaze / b2-sdk-python / test / test_parse_args.py View on Github external
def test_option_defaults(self):
        args = parse_arg_list(['req-value'], **self.EVERYTHING)
        self.assertFalse(args.optionFlag)
        self.assertTrue(args.optionArg is None)
        self.assertEqual([], args.list)
        self.assertEqual('req-value', args.required)
        self.assertTrue(args.optional is None)
github Backblaze / b2-sdk-python / test / test_parse_args.py View on Github external
def test_no_args(self):
        args = parse_arg_list([], **self.NO_ARGS)
        self.assertTrue(args is not None)
github Backblaze / b2-sdk-python / test / test_parse_args.py View on Github external
def test_optional_arg_missing_value(self):
        args = parse_arg_list(['--optionArg'], **self.EVERYTHING)
        self.assertTrue(args is None)
github Backblaze / b2-sdk-python / test / test_parse_args.py View on Github external
def test_unexpected_arg(self):
        args = parse_arg_list(['badArg'], **self.NO_ARGS)
        self.assertTrue(args is None)
github Backblaze / b2-sdk-python / test / test_parse_args.py View on Github external
def test_same_arg_in_two_places(self):
        arg_spec = dict(self.NO_ARGS)
        arg_spec['optional_before'] = ['a']
        arg_spec['required'] = ['a']
        with self.assertRaisesRegexp(
            ValueError, "argument 'a' is in both 'optional_before' an 'required'"
        ):
            parse_arg_list([], **arg_spec)
github Backblaze / b2-sdk-python / test / test_parse_args.py View on Github external
def test_optional_before(self):
        args = parse_arg_list(['a', 'b'], **self.BEFORE_AND_AFTER)
        self.assertEqual(('a', 'b', None), (args.optionalBefore, args.required, args.optional))
github Backblaze / b2-sdk-python / test / test_parse_args.py View on Github external
def test_unexpected_flag(self):
        args = parse_arg_list(['--badFlag'], **self.NO_ARGS)
        self.assertTrue(args is None)