def test_title_parser_converts_title_to_dict():
    for truthy, original, parsed, formatted in correct_title_names:
        if truthy:
            assert title_parser(original) == parsed
        else:
            try:
                assert title_parser(original) != parsed
            except:
                print 'Expected error converting mal-formed filename.'
Exemplo n.º 2
0
def test_title_parser_parses_id():
    title = '42'
    title_id = '42'

    assert title_parser(title)['title_id'] == title_id

    title = '24'
    title_id = '24'

    assert title_parser(title)['title_id'] == title_id
def test_title_parser_returns_a_six_item_dictionary():
    for truthy, original, parsed, formatted in correct_title_names:
        if truthy:
            assert len(title_parser(original)) == 6
        else:
            #not a meaningful test
            pass
def test_title_parser_returns_a_dictionary():
    for truthy, original, parsed, formatted in correct_title_names:
        if truthy:
            assert isinstance(title_parser(original), dict)
        else:
            #not a meaningful test
            pass
Exemplo n.º 5
0
def test_title_parser_converts_title_to_dict():

    correct_title_names = {
        '30 - Tape30 Side2 - L. Ron Hubbard 1.mp3': {
            'title_id': '30',
            'tape_number': '30',
            'side_id': 'B',
            'title': 'L. Ron Hubbard',
            'sub_chapter': '01',
            'file_type': 'mp3'
        },
        '30 - Tape10 Side1 - Battlefield Earth 20.mp4a': {
            'title_id': '30',
            'tape_number': '10',
            'side_id': 'A',
            'title': 'Battlefield Earth',
            'sub_chapter': '20',
            'file_type': 'mp4a'
        }
    }

    for input, output in correct_title_names.iteritems():
        assert title_parser(input) == output
Exemplo n.º 6
0
def test_title_parser_returns_a_six_item_dictionary():
    assert len(title_parser('')) == 6
Exemplo n.º 7
0
def test_title_parser_returns_a_dictionary():
    assert isinstance(title_parser(''), dict)