Whole file
jazzband/docopt-ng
The author described this change as “Raise exception if problems with finding 'usage:'.”. It counts as a record because the check below fails on the code as it stood at cb1bb7922 and passes on 4786f475c, with nothing else changed between the two runs.
Projectjazzband/docopt-ng
Fix saved2012-06-12
Sharing licenceMIT · LICENSE-MIT
Change size+6 −2
What the code was meant to do, written into the code itself as a save note
Raise exception if problems with finding 'usage:'.
The change
| 422 | 422 | ||
| 423 | 423 | ||
| 424 | 424 | def printable_usage(doc): | |
| 425 | - | return re.split(r'\n\s*\n', | |
| 426 | - | ''.join(re.split(r'([Uu][Ss][Aa][Gg][Ee]:)', doc)[1:]))[0].strip() | |
| 425 | + | usage_split = re.split(r'([Uu][Ss][Aa][Gg][Ee]:)', doc) | |
| 426 | + | if len(usage_split) < 3: | |
| 427 | + | raise DocoptLanguageError('"usage:" (case-insensitive) not found.') | |
| 428 | + | if len(usage_split) > 3: | |
| 429 | + | raise DocoptLanguageError('More than one "usage:" (case-insensitive).') | |
| 430 | + | return re.split(r'\n\s*\n', ''.join(usage_split[1:]))[0].strip() | |
| 427 | 431 | ||
| 428 | 432 | ||
| 429 | 433 | def formal_usage(printable_usage): |
The check that tells the two apart
fail→pass·test_docopt.py::test_language_errors
Check file test_docopt.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itcb1bb79224ff2ae18e8171c1fad45940ab457735
Broken version dated2012-06-12
Moduledocopt
Units changedprintable_usage
Fingerprint01a7640a354c7bb2
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.