| Index: third_party/typ/typ/tests/arg_parser_test.py
|
| diff --git a/third_party/typ/typ/tests/arg_parser_test.py b/third_party/typ/typ/tests/arg_parser_test.py
|
| index e603ecdc79e5254f5086a462aeae973a66911275..8e3a7bdcd64607eafc6d98f9b1bb2d137fe87bd7 100644
|
| --- a/third_party/typ/typ/tests/arg_parser_test.py
|
| +++ b/third_party/typ/typ/tests/arg_parser_test.py
|
| @@ -43,3 +43,34 @@ class ArgumentParserTest(unittest.TestCase):
|
| check(['--coverage', '--coverage-omit', 'foo'])
|
| check(['--jobs', '3'])
|
| check(['-vv'], ['--verbose', '--verbose'])
|
| +
|
| + def test_valid_shard_options(self):
|
| + parser = ArgumentParser()
|
| +
|
| + parser.parse_args(['--total-shards', '1'])
|
| + self.assertEqual(parser.exit_status, None)
|
| +
|
| + parser.parse_args(['--total-shards', '5', '--shard-index', '4'])
|
| + self.assertEqual(parser.exit_status, None)
|
| +
|
| + parser.parse_args(['--total-shards', '5', '--shard-index', '0'])
|
| + self.assertEqual(parser.exit_status, None)
|
| +
|
| +
|
| + def test_invalid_shard_options(self):
|
| + parser = ArgumentParser()
|
| +
|
| + parser.parse_args(['--total-shards', '0'])
|
| + self.assertEqual(parser.exit_status, 2)
|
| +
|
| + parser.parse_args(['--total-shards', '-1'])
|
| + self.assertEqual(parser.exit_status, 2)
|
| +
|
| + parser.parse_args(['--total-shards', '5', '--shard-index', '-1'])
|
| + self.assertEqual(parser.exit_status, 2)
|
| +
|
| + parser.parse_args(['--total-shards', '5', '--shard-index', '5'])
|
| + self.assertEqual(parser.exit_status, 2)
|
| +
|
| + parser.parse_args(['--total-shards', '5', '--shard-index', '6'])
|
| + self.assertEqual(parser.exit_status, 2)
|
|
|