def test_get_usage(self): option = Option("-a", String(metavar=u("foo"))) self.assert_equal(option.get_usage(), "-a foo") self.assert_equal(option.get_usage(using="long"), u("-a foo")) self.assert_equal(option.get_usage(using="both"), u("-a foo")) option = Option("-a", "--abc", String(metavar=u("foo"))) self.assert_equal(option.get_usage(), "-a foo") self.assert_equal(option.get_usage(using="long"), u("--abc foo")) self.assert_equal(option.get_usage(using="both"), u("-a foo, --abc foo"))
def test_matches(self): option = Option("-o", "--option", String()) self.assert_equal(option.matches("-a"), (False, "-a")) self.assert_equal(option.matches("-o"), (True, "")) self.assert_equal(option.matches("--asd"), (False, "--asd")) self.assert_equal(option.matches("--option"), (True, ""))