| 178 | |
| 179 | |
| 180 | def test_optional_match(): |
| 181 | assert Optional(Option('-a')).match([Option('-a')]) == \ |
| 182 | (True, [], [Option('-a')]) |
| 183 | assert Optional(Option('-a')).match([]) == (True, [], []) |
| 184 | assert Optional(Option('-a')).match([Option('-x')]) == \ |
| 185 | (True, [Option('-x')], []) |
| 186 | assert Optional(Option('-a'), Option('-b')).match([Option('-a')]) == \ |
| 187 | (True, [], [Option('-a')]) |
| 188 | assert Optional(Option('-a'), Option('-b')).match([Option('-b')]) == \ |
| 189 | (True, [], [Option('-b')]) |
| 190 | assert Optional(Option('-a'), Option('-b')).match([Option('-x')]) == \ |
| 191 | (True, [Option('-x')], []) |
| 192 | assert Optional(Argument('N')).match([Argument(None, 9)]) == \ |
| 193 | (True, [], [Argument('N', 9)]) |
| 194 | assert Optional(Option('-a'), Option('-b')).match( |
| 195 | [Option('-b'), Option('-x'), Option('-a')]) == \ |
| 196 | (True, [Option('-x')], [Option('-a'), Option('-b')]) |
| 197 | |
| 198 | |
| 199 | def test_required_match(): |