Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: third_party/typ/typ/tests/arg_parser_test.py

Issue 2077273002: Roll third_party/typ to 0.9.5. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698