Completed
Push — develop ( 4ae7a2...f1348d )
by Jace
02:26
created

yorm.test.is_false()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 2
rs 10
1
"""Unit tests for the `yorm` package."""
2
3
import time
4
import logging
5
6
import expecter
7
8
9
def is_true(x):
10
    return x is True
11
12
13
def is_false(x):
14
    return x is False
15
16
17
expecter.add_expectation(is_true)
18
expecter.add_expectation(is_false)
19
20
21
def strip(text, tabs=None, end='\n'):
22
    """Strip leading whitespace indentation on multiline string literals."""
23
    lines = []
24
25
    for line in text.strip().splitlines():
26
        if not tabs:
27
            tabs = line.count(' ' * 4)
28
        lines.append(line.replace(' ' * tabs * 4, '', 1))
29
30
    return '\n'.join(lines) + end
31
32
33
def refresh_file_modification_times(seconds=1.1):
34
    """Sleep to allow file modification times to refresh."""
35
    logging.info("Delaying for %s second%s...", seconds,
36
                 "" if seconds == 1 else "s")
37
    time.sleep(seconds)
38