/usr/lib/python2.7/dist-packages/manuel/testcase.py is in python-manuel 1.8.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | import manuel
import manuel.testing
import re
import string
import textwrap
punctuation = re.escape(string.punctuation)
SECTION_TITLE = re.compile(r'^.+$', re.MULTILINE)
SECTION_UNDERLINE = re.compile('^[' + punctuation + ']+\s*$', re.MULTILINE)
MARKER = re.compile(r'^.. test-case: (\S+)', re.MULTILINE)
def find_section_headers(document):
for region in document.find_regions(SECTION_TITLE, SECTION_UNDERLINE):
# regions that represent titles will have two lines
if region.source.count('\n') != 2:
continue
title, underline = region.source.splitlines()
# the underline has to be the same length as or longer than the title
if len(underline) < len(title):
continue
# ok, this is a region we want
document.claim_region(region)
test_case_name = title.strip()
region.parsed = manuel.testing.TestCaseMarker(test_case_name)
def find_markers(document):
for region in document.find_regions(MARKER):
document.claim_region(region)
test_case_name = region.start_match.group(1)
region.parsed = manuel.testing.TestCaseMarker(test_case_name)
class SectionManuel(manuel.Manuel):
def __init__(self):
manuel.Manuel.__init__(self, [find_section_headers])
class MarkerManuel(manuel.Manuel):
def __init__(self):
manuel.Manuel.__init__(self, [find_markers])
|