示例#1
0
def test_clean_filename_minimal_change():
    strings = {
        '(23:90)': '(23-90)',
        '(:': '(-',
        'a téest &and a@noòtheèr': 'a téest &and a@noòtheèr',
        'Lecture 2.7 - Evaluation and Operators (16:25)':
        'Lecture 2.7 - Evaluation and Operators (16-25)',
        'Week 3: Data and Abstraction':
        'Week 3- Data and Abstraction',
        '  (Week 1) BRANDING:  Marketing Strategy and Brand Positioning':
        '  (Week 1) BRANDING-  Marketing Strategy and Brand Positioning',
        'test & " adfas': 'test & " adfas',
        ' ': u'\xa0'
    }
    for k, v in six.iteritems(strings):
        actual_res = utils.clean_filename(k, minimal_change=True)
        assert actual_res == v, actual_res
示例#2
0
def test_clean_filename():
    strings = {
        '(23:90)': '23-90',
        '(:': '-',
        'a téest &and a@noòtheèr': 'a_test_and_another',
        'Lecture 2.7 - Evaluation and Operators (16:25)':
        'Lecture_2.7_-_Evaluation_and_Operators_16-25',
        'Week 3: Data and Abstraction':
        'Week_3-_Data_and_Abstraction',
        '  (Week 1) BRANDING:  Marketing Strategy and Brand Positioning':
        'Week_1_BRANDING-__Marketing_Strategy_and_Brand_Positioning',
        'test & " adfas': 'test___adfas',
        ' ': ''
    }
    for k, v in six.iteritems(strings):
        actual_res = utils.clean_filename(k)
        assert actual_res == v, actual_res