~testdoc-dev/testdoc/trunk.git

« back to all changes in this revision

Viewing changes to testdoc/documenter.py

  • Committer: Andrew Bennetts
  • Date: 2010-09-06 11:48:52 UTC
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: git-v1:c743e3b8dfbf65b6668a1f443171d1ca787a5e8e
Initial commit of hack to emit ReST.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
def gen_split_name(name,
18
18
                   wordRE=re.compile(
19
19
                       r'[0-9]+|[A-Z]?(?:(?:[A-Z](?![a-z]))+|[a-z]*)')):
 
20
    underscores = ''
20
21
    for word in name.split('_'):
 
22
        if word == '':
 
23
            underscores += '_'
21
24
        for bit in wordRE.findall(word):
22
25
            if len(bit) == 0:
23
26
                continue
24
27
            if len(bit) > 1 and bit.upper() == bit:
25
 
                yield bit
 
28
                yield underscores + bit
26
29
            else:
27
 
                yield bit.lower()
 
30
                yield underscores + bit.lower()
 
31
            underscores = ''
28
32
 
29
33
 
30
34
def title_case(words):
54
58
        return module_name
55
59
 
56
60
    def format_test(self, test_name):
57
 
        return title_case(split_name(test_name)[1:])
 
61
        return title_case(split_name(test_name)[1:]).lstrip()
58
62
 
59
63
    def format_test_class(self, class_name):
60
64
        return title_case(