2020from __future__ import annotations
2121
2222import json
23- from pathlib import Path
2423
2524import pytest
2625
@@ -40,7 +39,7 @@ def test_descriptions_json_loads():
4039 # Check that required entities exist
4140 required_entities = ['preproc' , 'brain' , 'hmc' , 'coreg' , 'confounds' ]
4241 for entity in required_entities :
43- assert entity in desc_data ['entities' ], f" Missing required entity: { entity } "
42+ assert entity in desc_data ['entities' ], f' Missing required entity: { entity } '
4443
4544
4645@pytest .mark .ai_generated
@@ -55,15 +54,15 @@ def test_descriptions_json_structure():
5554
5655 # Parameters must be a list if present
5756 if 'parameters' in entity_def :
58- assert isinstance (
59- entity_def [ 'parameters' ], list
60- ), f"Entity ' { entity_id } ' parameters must be list"
57+ assert isinstance (entity_def [ 'parameters' ], list ), (
58+ f"Entity ' { entity_id } ' parameters must be list"
59+ )
6160
6261 # Conditional parts must have correct structure if present
6362 if 'conditional_parts' in entity_def :
64- assert isinstance (
65- entity_def [ 'conditional_parts' ], list
66- ), f"Entity ' { entity_id } ' conditional_parts must be list"
63+ assert isinstance (entity_def [ 'conditional_parts' ], list ), (
64+ f"Entity ' { entity_id } ' conditional_parts must be list"
65+ )
6766 for part in entity_def ['conditional_parts' ]:
6867 assert 'condition' in part , f"Entity '{ entity_id } ' part missing condition"
6968 assert 'text' in part , f"Entity '{ entity_id } ' part missing text"
@@ -90,7 +89,7 @@ def test_write_descriptions_tsv_basic(tmp_path):
9089 # Parse rows
9190 for line in lines [1 :]:
9291 parts = line .split ('\t ' )
93- assert len (parts ) == 3 , f" Each row should have 3 columns: { line } "
92+ assert len (parts ) == 3 , f' Each row should have 3 columns: { line } '
9493 desc_id , description , parameters = parts
9594
9695 # Check parameters is valid JSON
@@ -129,7 +128,7 @@ def test_write_descriptions_tsv_with_sdc(tmp_path):
129128 assert parameters ['sdc_method' ] == 'TOPUP'
130129 break
131130 else :
132- pytest .fail (" preproc row not found" )
131+ pytest .fail (' preproc row not found' )
133132
134133
135134@pytest .mark .ai_generated
@@ -161,7 +160,7 @@ def test_write_descriptions_tsv_without_sdc(tmp_path):
161160 assert parameters ['stc_applied' ] is False
162161 break
163162 else :
164- pytest .fail (" preproc row not found" )
163+ pytest .fail (' preproc row not found' )
165164
166165
167166@pytest .mark .ai_generated
@@ -257,6 +256,6 @@ def test_write_descriptions_tsv_all_entities_present(tmp_path):
257256 found_entities .add (desc_id )
258257
259258 assert found_entities == expected_entities , (
260- f" Missing entities: { expected_entities - found_entities } , "
261- f" Extra entities: { found_entities - expected_entities } "
259+ f' Missing entities: { expected_entities - found_entities } , '
260+ f' Extra entities: { found_entities - expected_entities } '
262261 )
0 commit comments