55import pytest
66
77from neurodamus .core .coreneuron_report_config import CoreReportConfig
8+ from neurodamus .core .coreneuron_simulation_config import CoreSimulationConfig
9+ from neurodamus .core .configuration import SimConfig
10+ from neurodamus .core .configuration import CellPermute
811
912@pytest .mark .parametrize (
1013 "create_tmp_simulation_config_file" ,
@@ -196,3 +199,75 @@ def test_cli_report_buff_invalid(create_tmp_simulation_config_file):
196199 result = subprocess .run (command , check = False , capture_output = True , text = True )
197200
198201 assert "Report buffer size must be > 0" in result .stdout
202+
203+ @pytest .mark .parametrize (
204+ "create_tmp_simulation_config_file" ,
205+ [{"simconfig_fixture" : "ringtest_baseconfig" ,
206+ "extra_config" : {
207+ "target_simulator" : "CORENEURON" ,
208+ }
209+ }],
210+ indirect = True ,
211+ )
212+ def test_cli_cell_permute_simple_setting (create_tmp_simulation_config_file ):
213+ command = ["neurodamus" , create_tmp_simulation_config_file , "--cell-permute=1" , "--keep-build" ]
214+ subprocess .run (command , check = False , capture_output = True , text = True )
215+ sim_conf = CoreSimulationConfig .load ("build/sim.conf" )
216+ assert sim_conf .cell_permute == 1
217+
218+ @pytest .mark .parametrize (
219+ "create_tmp_simulation_config_file" ,
220+ [{"simconfig_fixture" : "ringtest_baseconfig" ,
221+ "extra_config" : {
222+ "target_simulator" : "CORENEURON" ,
223+ }
224+ }],
225+ indirect = True ,
226+ )
227+ def test_cli_cell_permute_default (create_tmp_simulation_config_file ):
228+ command = ["neurodamus" , create_tmp_simulation_config_file , "--keep-build" ]
229+ subprocess .run (command , check = False , capture_output = True , text = True )
230+ sim_conf = CoreSimulationConfig .load ("build/sim.conf" )
231+ assert sim_conf .cell_permute == 0
232+
233+ @pytest .mark .parametrize (
234+ "create_tmp_simulation_config_file" ,
235+ [{"simconfig_fixture" : "ringtest_baseconfig" ,
236+ "extra_config" : {
237+ "target_simulator" : "CORENEURON" ,
238+ }
239+ }],
240+ indirect = True ,
241+ )
242+ def test_cli_cell_permute_simple_setting_python (create_tmp_simulation_config_file ):
243+ from neurodamus import Neurodamus
244+ nd = Neurodamus (create_tmp_simulation_config_file , cell_permute = 1 )
245+ assert SimConfig .cell_permute == CellPermute .NODE_ADJACENCY
246+
247+ @pytest .mark .parametrize (
248+ "create_tmp_simulation_config_file" ,
249+ [{"simconfig_fixture" : "ringtest_baseconfig" ,
250+ "extra_config" : {
251+ "target_simulator" : "CORENEURON" ,
252+ }
253+ }],
254+ indirect = True ,
255+ )
256+ def test_cli_cell_permute_default_python (create_tmp_simulation_config_file ):
257+ from neurodamus import Neurodamus
258+ nd = Neurodamus (create_tmp_simulation_config_file )
259+ assert SimConfig .cell_permute == CellPermute .NONE
260+
261+ @pytest .mark .parametrize (
262+ "create_tmp_simulation_config_file" ,
263+ [{"simconfig_fixture" : "ringtest_baseconfig" ,
264+ "extra_config" : {
265+ "target_simulator" : "CORENEURON" ,
266+ }
267+ }],
268+ indirect = True ,
269+ )
270+ def test_cli_cell_permute_invalid (create_tmp_simulation_config_file ):
271+ command = ["neurodamus" , create_tmp_simulation_config_file , "--cell-permute=2" ]
272+ result = subprocess .run (command , check = False , capture_output = True , text = True )
273+ assert "'2' is not a valid CellPermute" in result .stdout
0 commit comments