def test_none_value():
    with patch('python_test.json') as data:
        data.loads.return_value = None
        try:
            python_test.main()
            assert False
        except TypeError:
            assert True
def test_copy_commands():
    parse_commands, copy_commands, functional_commands, random_commands = python_test.main(
    )
    assert copy_commands == [{
        'function': 'copy',
        'help': 'copy help',
        'value': 'file'
    }]
def test_functional_commands():
    parse_commands, copy_commands, functional_commands, random_commands = python_test.main(
    )
    assert functional_commands == [{
        'function': 'parse',
        'help': 'file help',
        'value': 'file',
        '_list': 'parse',
        '_counter': 1
    }, {
        'function': 'copy',
        'help': 'copy help',
        'value': 'file',
        '_list': 'copy',
        '_counter': 1
    }]
def test_functional_commands():
    parse_commands, copy_commands, functional_commands, random_commands = python_test.main()
    assert len(random_commands) == 2
Exemple #5
0
def test_mock_random():
    with patch('python_test.random') as random_sample:
        random_sample.sample.return_value = [{'function': 'parse'}, {'function': 'copy'}, {'function': 'test'}]
        parse_commands, copy_commands, functional_commands, random_commands = python_test.main()
        assert len(random_commands) == 3