Пример #1
0
 def test_default(self):
     cli = CommandLineInterface("test")
     cli.build_parser()
     cli.add_date_option("--test-date", arrow.get("2016-09-22"), "help")
     assert cli.parser._actions[2].default == arrow.get("2016-09-22")
Пример #2
0
 def test_help(self):
     cli = CommandLineInterface("test")
     cli.build_parser()
     cli.add_date_option("--test-date", arrow.get("2016-09-22"), "Help message.")
     expected = "Help message. Use YYYY-MM-DD format. Defaults to 2016-09-22."
     assert cli.parser._actions[2].help == expected
Пример #3
0
 def test_option_name(self):
     cli = CommandLineInterface("test")
     cli.build_parser()
     cli.add_date_option("--test-date", arrow.get("2016-09-22"), "help")
     assert cli.parser._actions[2].option_strings == ["--test-date"]