Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow tabs in DocTestParser #24

Closed
jacksonllee opened this issue Nov 28, 2020 · 5 comments
Closed

Allow tabs in DocTestParser #24

jacksonllee opened this issue Nov 28, 2020 · 5 comments

Comments

@jacksonllee
Copy link

Hello, thank you very much for this nifty library! In my use case, there are non-Python blocks that contain tabs but these tabs should just be ignored. My workaround is to let DocTestParser take an allow_tabs kwarg in my fork:

https://github.com/jacksonllee/sybil/commit/68944ab9881c8af70254317f36ae996e32faf25c

If there's any interest, I'd be more than happy to contribute a pull request so that it's available in the upstream source here as well.

@cjw296
Copy link
Member

cjw296 commented Nov 29, 2020

Can you share some examples of these non-Python blocks?
If they're not Python, how does doctest evaluate them?

@jacksonllee
Copy link
Author

Can you share some examples of these non-Python blocks?

Absolutely. I use the reStructuredText block to illustrate a text format that happens to use tabs. Here's an (actual) example (source):

To illustrate, let us consider the following CHAT utterance with its ``%mor``
tier::

    *XXA:	喂 遲 啲 去 唔 去 旅行 啊 ?
    %mor:	e|wai3 a|ci4 u|di1 v|heoi3 d|m4 v|heoi3 vn|leoi5hang4 y|aa3 ?

If they're not Python, how does doctest evaluate them?

I'm not sure -- I haven't dug into the internals of doctest / Sybil too much. For my use case. I'd want doctest / Sybil to simply ignore blocks like this, which the commit I referred to above would allow when allow_tabs=True in DocTestParser. Would there by any chance be a better way to accomplish this that I've missed?

@cjw296
Copy link
Member

cjw296 commented Nov 29, 2020

Ah, so the problem is actually that doctest is spotting tabs in blocks it won't even match...

@cjw296
Copy link
Member

cjw296 commented Nov 29, 2020

43445d8 should resolve this, it'll be in a 2.0.1 release as soon as CI finishes running.

@cjw296 cjw296 closed this as completed Nov 29, 2020
@jacksonllee
Copy link
Author

Thank you for the quick fix! I've just upgraded to Sybil 2.0.1 and my CI also passed as well. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants