-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest_Utils.py
More file actions
executable file
·86 lines (51 loc) · 1.9 KB
/
Test_Utils.py
File metadata and controls
executable file
·86 lines (51 loc) · 1.9 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 1 10:22:10 2022
@author: simula
"""
import Utils as ut
###############################################################################
def test_trim_string_alphanum():
"""
Test the success of the function to trim a string on the default mode 'alpha-num'.
Returns
-------
None.
"""
sample = 'ab!cd3??456erd21#@'
trimmed = ut.trim_string(sample, mode = 'alpha-num', trim_from = '')
assert trimmed == 'abcd3456erd21'
###############################################################################
def test_trim_string_alpha():
"""
Test the success of the function to trim a string on the default mode 'alpha'.
Returns
-------
None.
"""
sample = 'ab!cd3??456erd21#@'
trimmed = ut.trim_string(sample, mode = 'alpha', trim_from = '')
assert trimmed == 'abcderd'
###############################################################################
def test_trim_string_num():
"""
Test the success of the function to trim a string on the default mode 'num'.
Returns
-------
None.
"""
sample = 'ab!cd3??456erd21#@'
trimmed = ut.trim_string(sample, mode = 'num', trim_from = '')
assert trimmed == '345621'
###############################################################################
def test_trim_string_user():
"""
Test the success of the function to trim a string on the user defined 'trim_from'
Returns
-------
None.
"""
sample = 'ab!cd3??456erd21#@'
trimmed = ut.trim_string(sample, mode = 'user', trim_from = '#@?!')
assert trimmed == '!??#@'
###############################################################################