summaryrefslogtreecommitdiff
path: root/coverage/misc.py
blob: 15ddad081ad9305715304d1007dab63bcd768292 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Miscellaneous stuff for coverage.py"""

def nice_pair(pair):
    """Make a nice string representation of a pair of numbers.
    
    If the numbers are equal, just return the number, otherwise return the pair
    with a dash between them, indicating the range.
    
    """
    start, end = pair
    if start == end:
        return "%d" % start
    else:
        return "%d-%d" % (start, end)


class CoverageException(Exception):
    pass