Core: Support inequality operators ("less than") for Choice option string comparisons (#3769)

* add some unit tests to it

* fix

* Update Options.py

Co-authored-by: qwint <qwint.42@gmail.com>

* Update Options.py

---------

Co-authored-by: qwint <qwint.42@gmail.com>
This commit is contained in:
NewSoupVi
2025-07-27 23:29:21 +02:00
committed by GitHub
parent ea1e074083
commit 04a3f78605
5 changed files with 37 additions and 4 deletions

View File

@@ -33,6 +33,15 @@ class TestNumericOptions(unittest.TestCase):
self.assertEqual(choice_option_alias, TestChoice.alias_three)
self.assertEqual(choice_option_attr, TestChoice.non_option_attr)
self.assertLess(choice_option_string, "two")
self.assertGreater(choice_option_string, "zero")
self.assertLessEqual(choice_option_string, "one")
self.assertLessEqual(choice_option_string, "two")
self.assertGreaterEqual(choice_option_string, "one")
self.assertGreaterEqual(choice_option_string, "zero")
self.assertGreaterEqual(choice_option_alias, "three")
self.assertRaises(KeyError, TestChoice.from_any, "four")
self.assertIn(choice_option_int, [1, 2, 3])