-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_sub_shifter.py
51 lines (37 loc) · 1.44 KB
/
test_sub_shifter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import pytest
import sub_shifter
# test get_new_filename
#
def test_numeric_input():
with pytest.raises(TypeError):
sub_shifter.get_new_filename(12)
def test_other_data_types_input():
with pytest.raises(TypeError):
sub_shifter.get_new_filename([1,2,3])
def test_more_than_one_argument():
with pytest.raises(TypeError):
sub_shifter.get_new_filename('new_file.srt', 45)
def test_blank_str():
assert sub_shifter.get_new_filename('') == '_edited'
def test_path_only_dot():
assert sub_shifter.get_new_filename('.') == '_edited'
def test_valid_path_win():
path = r'E:\python_proj\subtitle_timing_changer\sub_shifter.py'
assert sub_shifter.get_new_filename(path) == 'sub_shifter_edited.py'
def test_valid_path_lin():
path = '/mnt/sherpa/Marketing'
assert sub_shifter.get_new_filename(path) == 'Marketing_edited'
def test_valid_path_mac():
path = '/Volumes/sherpa/Marketing'
assert sub_shifter.get_new_filename(path) == 'Marketing_edited'
def test_file_with_extention():
# present in other testcases
pass
def test_file_without_extention():
# present in other testcases
pass
def test_relative_path():
path = r'..pytest_cache\v\cache\last_failed'
assert sub_shifter.get_new_filename(path) == 'last_failed_edited'
# path = r"E:\!MOVIES\All.of.Us.Are.Dead.S01.WEBRip.Rus.HDRezka\An.Education.2009.720p.BluRay.x264.[YTS.MX]-English.srt"
# main([os.getcwd(), path, '+5'])