@@ -29,7 +29,8 @@ def setUp(self):
2929 target_id = self .target .id ,
3030 )
3131 self .data_products = DataProductFactory .create_batch (
32- 3 , observation_record = self .observation_record ,
32+ 3 ,
33+ observation_record = self .observation_record ,
3334 )
3435 for data_product in self .data_products :
3536 ReducedDatumFactory .create (data_product = data_product )
@@ -45,16 +46,19 @@ def test_delete_data_products_for_observation_record(self):
4546 )
4647 for data_product in self .data_products :
4748 self .assertEqual (
48- ReducedDatum .objects .filter (data_product = data_product ).count (), 0 ,
49+ ReducedDatum .objects .filter (data_product = data_product ).count (),
50+ 0 ,
4951 )
5052
5153 def test_delete_single_data_product (self ):
5254 single_data_product = self .data_products [0 ]
55+ pk = single_data_product .pk
5356 delete_associated_data_products (single_data_product )
5457
55- self .assertFalse (DataProduct .objects .filter (pk = single_data_product . pk ).exists ())
58+ self .assertFalse (DataProduct .objects .filter (pk = pk ).exists ())
5659 self .assertEqual (
57- ReducedDatum .objects .filter (data_product = single_data_product ).count (), 0 ,
60+ ReducedDatum .objects .filter (data_product_id = pk ).count (),
61+ 0 ,
5862 )
5963
6064 def test_delete_file_and_thumbnail (self ):
@@ -70,7 +74,8 @@ def test_delete_file_and_thumbnail(self):
7074 # Check if files and thumbnails are deleted from the disk.
7175 for data_path , thumbnail_path in file_paths :
7276 self .assertFalse (
73- os .path .exists (data_path ), f"Data file { data_path } should be deleted." ,
77+ os .path .exists (data_path ),
78+ f"Data file { data_path } should be deleted." ,
7479 )
7580 self .assertFalse (
7681 os .path .exists (thumbnail_path ),
@@ -90,7 +95,8 @@ def test_success_response(self):
9095 response = build_json_response ()
9196 self .assertEqual (response .status_code , status .HTTP_200_OK )
9297 self .assertEqual (
93- response .content .decode (), '{"status": "success", "message": ""}' ,
98+ response .content .decode (),
99+ '{"status": "success", "message": ""}' ,
94100 )
95101
96102 def test_error_response_with_custom_message (self ):
@@ -108,7 +114,8 @@ def test_error_response_with_custom_status(self):
108114 error_message = "Not found"
109115 error_status = status .HTTP_404_NOT_FOUND
110116 response = build_json_response (
111- error_message = error_message , error_status = error_status ,
117+ error_message = error_message ,
118+ error_status = error_status ,
112119 )
113120 self .assertEqual (response .status_code , error_status )
114121 self .assertEqual (
@@ -123,7 +130,8 @@ def test_error_response_with_custom_message_and_status(self):
123130 error_message = "Unauthorized access"
124131 error_status = status .HTTP_401_UNAUTHORIZED
125132 response = build_json_response (
126- error_message = error_message , error_status = error_status ,
133+ error_message = error_message ,
134+ error_status = error_status ,
127135 )
128136 self .assertEqual (response .status_code , error_status )
129137 self .assertEqual (
@@ -135,7 +143,8 @@ def test_error_response_with_custom_message_and_status(self):
135143@pytest .fixture ()
136144def non_empty_file_list ():
137145 return Table (
138- rows = [("file1" , "red1" ), ("file2" , "red2" )], names = ("name" , "reduction" ),
146+ rows = [("file1" , "red1" ), ("file2" , "red2" )],
147+ names = ("name" , "reduction" ),
139148 )
140149
141150
0 commit comments