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

doctest handles comments incorrectly #37774

Closed
aschmolck mannequin opened this issue Jan 15, 2003 · 4 comments
Closed

doctest handles comments incorrectly #37774

aschmolck mannequin opened this issue Jan 15, 2003 · 4 comments
Labels
stdlib Python modules in the Lib dir

Comments

@aschmolck
Copy link
Mannequin

aschmolck mannequin commented Jan 15, 2003

BPO 668500
Nosy @tim-one, @rhettinger
Files
  • doctest.py.PATCH
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2004-02-17.00:41:09.000>
    created_at = <Date 2003-01-15.14:39:52.000>
    labels = ['library']
    title = 'doctest handles comments incorrectly'
    updated_at = <Date 2004-02-17.00:41:09.000>
    user = 'https://bugs.python.org/aschmolck'

    bugs.python.org fields:

    activity = <Date 2004-02-17.00:41:09.000>
    actor = 'tim.peters'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2003-01-15.14:39:52.000>
    creator = 'aschmolck'
    dependencies = []
    files = ['4921']
    hgrepos = []
    issue_num = 668500
    keywords = ['patch']
    message_count = 4.0
    messages = ['42430', '42431', '42432', '42433']
    nosy_count = 3.0
    nosy_names = ['tim.peters', 'rhettinger', 'aschmolck']
    pr_nums = []
    priority = 'normal'
    resolution = 'rejected'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue668500'
    versions = ['Python 2.2']

    @aschmolck
    Copy link
    Mannequin Author

    aschmolck mannequin commented Jan 15, 2003

    > >    import doctest, test
    > >    def aTest():
    > >        r""">>> # A comment
    > >            ... print 'This is incorrectly ignored
    by doctest'
    > >            This output here really doesn't matter
    either... (but SHOULD)
    > >            >>>
    > >            """

    the patch fixes that and passes the original doctest
    tests. (test_doctest and doctest.py itself)

    @aschmolck aschmolck mannequin closed this as completed Jan 15, 2003
    @aschmolck aschmolck mannequin added the stdlib Python modules in the Lib dir label Jan 15, 2003
    @aschmolck aschmolck mannequin closed this as completed Jan 15, 2003
    @aschmolck aschmolck mannequin added the stdlib Python modules in the Lib dir label Jan 15, 2003
    @rhettinger
    Copy link
    Contributor

    Logged In: YES
    user_id=80475

    The file attachment didn't make it.

    @tim-one
    Copy link
    Member

    tim-one commented Jan 16, 2003

    Logged In: YES
    user_id=31435

    Alexander, you need to check the "Check to Upload and
    Attach a File" box when trying to attach a file. This is a
    SourceForge annoyance we have no control over. Please
    try again!

    @tim-one
    Copy link
    Member

    tim-one commented Feb 17, 2004

    Logged In: YES
    user_id=31435

    It's intentional that doctest looks for PS1 to identify lines that
    begin Python statements, and I'm opposed to changing that.
    The docs could be clearer on this point. I don't care that the
    Python command-line shell is braindead in starting a line
    following a comment with PS2. The IDLE shell, and the
    PythonWin shell, are not insane in this respect, and I don't
    want doctest to be in the business of guessing intent across
    the union of all stupid things all Python shells do. As the docs
    say, "In most cases a copy-and-paste of an interactive
    console session works fine". "most" < "all", because of goofy
    exceptions like this one. doctest has its own rules for
    distinguishing among intial lines, continuation lines, and output
    lines, and I want to keep them as simple as they are.

    In your specific example, change the doctest to use PS1
    instead of PS2 on the 'print' line, and it should work fine.

    While I'm rejecting this patch, I'd be happy to see a patch to
    make the Python command-line shell smarter in this case.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants