import re


def demo_id(filename):
    """Get the demo_number from a test macro"""
    b1 = re.match('.*/test_demo\d{2}\.py', filename)
    found = re.findall('.*/test_demo(\d{2})\.py', filename)
    b2 = len(found) == 1
    is_test_file = b1 and b2
    assert is_test_file, 'Not a test file: "%s"' % filename
    return int(found[0])