Erotemic / xdoctest

A rewrite of Python's builtin doctest module (with pytest plugin integration) with AST instead of REGEX.
Apache License 2.0
209 stars 12 forks source link

Quotation mark style is too strict #87

Open Zeitsperre opened 4 years ago

Zeitsperre commented 4 years ago

Just noticed this on a few of my failing builds today:

DOCTEST TRACEBACK
Expected:
    "La moyenne annuelle est faite sur un échantillon mensuel"

Got:
    'La moyenne annuelle est faite sur un échantillon mensuel'

Repr Difference:
    got  = "'La moyenne annuelle est faite sur un échantillon mensuel'"
    want = '"La moyenne annuelle est faite sur un échantillon mensuel"'

Poking around, this seems to also be an issue in stdlib doctest. Any potential to relax this level of scrutiny on strings?

Erotemic commented 4 years ago

You can submit a PR to the checker.py file where fuzzy matching happens as long as it is an option that is disabled by default.

We can talk about what the default state should be, but I want to preserve backwards compatibility within the remainder of the 0.x series. Note that any fuzzy matching does break cases where the string is ambiguous, so there are trade-offs to enabling fuzzy matching by default.

Or you can use the existing ... auto-enabled fuzzy match syntax in place of your quotes.

Zeitsperre commented 4 years ago

Thanks for the quick response. We may need to use the work-around for now, but would really like to see a way (flag?) for easing the rules on string quotations.

I can look into how difficult this would be for me to submit a PR, but it'll have to be in my free time. Please keep this issue open for the time being. Cheers.