annotation is incorrectly marking multiline comments as "not executed".

Issue #595 invalid
Ijaz Sarwar created an issue
'''
multi-line
comment
'''

"""
also,
multi-line comment
"""

print 'Hello, world!'
# this is single line comment

After doing annotation on above code I get

! '''
! multi-line
! comment
! '''

! """
! also,
! multi-line comment
! """

! print 'Hello, world!'
  # this is single line comment

Why is multiline comments are treated as "not executed"? There is nothing to execute there because that is just a comment.

Comments (3)

  1. Ijaz Sarwar reporter

    My expectation was that single line comment and multi line comments should both be treated as same way. Which means instead of adding ! to line there should be just two spaces (like we did for single line comment)

  2. Ned Batchelder repo owner

    Those are not comments, they are strings, which means they are expressions that can be executed or not executed.

  3. Ijaz Sarwar reporter

    Thanks! But fyi coverage xml would treat it as comments.

    <?xml version="1.0" ?>
    <coverage branch-rate="0" branches-covered="0" branches-valid="0" complexity="0" line-rate="1" lines-covered="1" lines-valid="1" timestamp="1502500038756" version="4.4.1">
            <!-- Generated by coverage.py: https://coverage.readthedocs.io -->
            <!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
            <sources>
                    <source>/home/isarwar/Documents/SourceCode/av</source>
            </sources>
            <packages>
                    <package branch-rate="0" complexity="0" line-rate="1" name=".">
                            <classes>
                                    <class branch-rate="0" complexity="0" filename="hello.py" line-rate="1" name="hello.py">
                                            <methods/>
                                            <lines>
                                                    <line hits="1" number="11"/>
                                            </lines>
                                    </class>
                            </classes>
                    </package>
            </packages>
    </coverage>
    
  4. Log in to comment