@@ -50,10 +50,7 @@ def test_extract_file_dir_path(file_meta: FileMeta):
50
50
@mark .parametrize (
51
51
"tup,verifier" ,
52
52
[
53
- (
54
- "('text', 42)" ,
55
- lambda tup : isinstance (tup , tuple ) and tup [0 ] == "text" and tup [1 ] == 42 ,
56
- ),
53
+ ("('text', 42)" , lambda tup : isinstance (tup , tuple ) and tup [0 ] == "text" and tup [1 ] == 42 ),
57
54
("()" , lambda tup : tup == ()),
58
55
],
59
56
)
@@ -79,9 +76,7 @@ def test_generate_random_dir_path(subdir_count: int):
79
76
80
77
81
78
@given (subdir_count = integers (max_value = - 1 ))
82
- def test_when_generating_random_dir_path_given_invalid_arguments_should_raise (
83
- subdir_count : int
84
- ):
79
+ def test_when_generating_random_dir_path_given_invalid_arguments_should_raise (subdir_count : int ):
85
80
with raises (ValueError ):
86
81
generate_random_dir_path (subdir_count )
87
82
@@ -91,10 +86,7 @@ def test_when_generating_random_file_name_with_extension_given_valid_arguments_s
91
86
):
92
87
file_extension = file_meta .extension
93
88
actual_file_basename = generate_random_file_name_with_extension (file_extension )
94
- assert (
95
- extract_file_name_and_extension (actual_file_basename ).extension
96
- == file_extension
97
- )
89
+ assert extract_file_name_and_extension (actual_file_basename ).extension == file_extension
98
90
99
91
100
92
@mark .parametrize (
@@ -105,14 +97,9 @@ def test_when_generating_random_file_name_with_extension_given_valid_arguments_s
105
97
],
106
98
)
107
99
def test_read_file (
108
- tmpdir_factory ,
109
- file_meta : FileMeta ,
110
- as_single_line : bool ,
111
- verifier : Callable [[str ], bool ],
100
+ tmpdir_factory , file_meta : FileMeta , as_single_line : bool , verifier : Callable [[str ], bool ]
112
101
):
113
- tmp_file_path = generate_tmp_file_path (
114
- tmpdir_factory , file_meta .name_with_extension
115
- )
102
+ tmp_file_path = generate_tmp_file_path (tmpdir_factory , file_meta .name_with_extension )
116
103
create_or_update_file (tmp_file_path , file_meta .content , file_meta .content_encoding )
117
104
118
105
file_content = read_file (tmp_file_path , as_single_line )
@@ -147,17 +134,13 @@ def test_get_file_paths(
147
134
# ...with a disallowed extension:
148
135
file_extension_suffix = "z"
149
136
if len (allowed_file_extensions ) > 0 :
150
- disallowed_file_extension = (
151
- allowed_file_extensions [- 1 ] + file_extension_suffix
152
- )
137
+ disallowed_file_extension = allowed_file_extensions [- 1 ] + file_extension_suffix
153
138
else :
154
139
disallowed_file_extension = ".{}" .format (file_extension_suffix )
155
140
disallowed_file_name_with_extension = generate_random_file_name_with_extension (
156
141
disallowed_file_extension
157
142
)
158
- disallowed_file_path = os .path .join (
159
- dir_path , disallowed_file_name_with_extension
160
- )
143
+ disallowed_file_path = os .path .join (dir_path , disallowed_file_name_with_extension )
161
144
# ...with allowed extensions:
162
145
allowed_file_names_with_extension = [
163
146
generate_random_file_name_with_extension (e ) for e in allowed_file_extensions
@@ -202,9 +185,7 @@ def test_when_creating_or_updating_file_given_file_exists_should_update_file(
202
185
file .write (file_meta .content .encode (file_meta .content_encoding ))
203
186
204
187
updated_file_content = file_meta .content + " (+ this update)"
205
- create_or_update_file (
206
- tmp_file_path , updated_file_content , file_meta .content_encoding
207
- )
188
+ create_or_update_file (tmp_file_path , updated_file_content , file_meta .content_encoding )
208
189
209
190
with open (tmp_file_path , "rb" ) as file :
210
191
assert file .read ().decode (file_meta .content_encoding ) == updated_file_content
0 commit comments