| 207 | |
| 208 | |
| 209 | def test_either_match(): |
| 210 | assert Either(Option('-a'), Option('-b')).match( |
| 211 | [Option('-a')]) == (True, [], [Option('-a')]) |
| 212 | assert Either(Option('-a'), Option('-b')).match( |
| 213 | [Option('-a'), Option('-b')]) == \ |
| 214 | (True, [Option('-b')], [Option('-a')]) |
| 215 | assert Either(Option('-a'), Option('-b')).match( |
| 216 | [Option('-x')]) == (False, [Option('-x')], []) |
| 217 | assert Either(Option('-a'), Option('-b'), Option('-c')).match( |
| 218 | [Option('-x'), Option('-b')]) == \ |
| 219 | (True, [Option('-x')], [Option('-b')]) |
| 220 | assert Either(Argument('M'), |
| 221 | Required(Argument('N'), Argument('M'))).match( |
| 222 | [Argument(None, 1), Argument(None, 2)]) == \ |
| 223 | (True, [], [Argument('N', 1), Argument('M', 2)]) |
| 224 | |
| 225 | |
| 226 | def test_one_or_more_match(): |