Code Duplication    Length = 16-16 lines in 2 locations

elodie/tests/log_test.py 2 locations

@@ 52-67 (lines=16) @@
49
    for func in [log.info_json, log.warn_json, log.error_json]:
50
        call_log_and_assert(func, [expected_json], with_new_line(dumps(expected_json)))
51
52
@patch('elodie.log')
53
@patch('elodie.constants.debug', False)
54
def test_calls_print_debug_false(fake_log):
55
    expected = 'some other string'
56
    fake_log.info.return_value = expected
57
    fake_log.warn.return_value = expected
58
    fake_log.error.return_value = expected
59
    for func in [log.info, log.warn, log.error]:
60
        call_log_and_assert(func, [expected], '')
61
62
    expected_json = {'foo':'bar'}
63
    fake_log.info.return_value = expected_json
64
    fake_log.warn.return_value = expected_json
65
    fake_log.error.return_value = expected_json
66
    for func in [log.info_json, log.warn_json, log.error_json]:
67
        call_log_and_assert(func, [expected_json], '')
68
69
@patch('elodie.log')
70
def test_calls_print_progress_no_new_line(fake_log):
@@ 35-50 (lines=16) @@
32
def with_new_line(string):
33
    return "{}\n".format(string)
34
35
@patch('elodie.log')
36
@patch('elodie.constants.debug', True)
37
def test_calls_print_debug_true(fake_log):
38
    expected = 'some string'
39
    fake_log.info.return_value = expected
40
    fake_log.warn.return_value = expected
41
    fake_log.error.return_value = expected
42
    for func in [log.info, log.warn, log.error]:
43
        call_log_and_assert(func, [expected], with_new_line(expected))
44
45
    expected_json = {'foo':'bar'}
46
    fake_log.info.return_value = expected_json
47
    fake_log.warn.return_value = expected_json
48
    fake_log.error.return_value = expected_json
49
    for func in [log.info_json, log.warn_json, log.error_json]:
50
        call_log_and_assert(func, [expected_json], with_new_line(dumps(expected_json)))
51
52
@patch('elodie.log')
53
@patch('elodie.constants.debug', False)