about summary refs log tree commit diff
path: root/universe/ac_types/test_utils.py
blob: 1c1570754eb663844528ebcf28af54b0260e9d39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
silent_on_success = True


# I need to define this herein to avoid introducing a circular dependency.
def with_banner(x):
    header = '#################################################################'
    text = '# {}'.format(x)
    footer = '#################################################################'
    return '\n'.join([header, text, footer])


def simple_assert(actual, expected, name=None):
    try:
        assert actual == expected
        if silent_on_success:
            return None
        else:
            print(with_banner('{}: Test passes!'.format(name)))
    except:
        print(with_banner('{}: Test failure.'.format(name)))
        print(actual)