@@ -496,14 +496,20 @@ def mock_cli_workflows():
496496 patch (f"{ module_name } .write_html_report" ) as mock_write :
497497
498498 # Setup default success returns
499- mock_sweep .return_value = MagicMock (success = True , message = "Success" , output_path = "out" , errors = [])
499+ mock_sweep .return_value = MagicMock (
500+ success = True , message = "Success" , output_path = "out" , errors = []
501+ )
500502
501503 # Fix for JSON serialization: to_dict should return a real dict
502- compare_result = MagicMock (success = True , message = "Success" , output_path = "out" , data = {}, errors = [])
504+ compare_result = MagicMock (
505+ success = True , message = "Success" , output_path = "out" , data = {}, errors = []
506+ )
503507 compare_result .to_dict .return_value = {"success" : True , "message" : "Success" }
504508 mock_compare .return_value = compare_result
505509
506- mock_tuning .return_value = MagicMock (success = True , message = "Success" , output_path = "out" , data = {}, errors = [])
510+ mock_tuning .return_value = MagicMock (
511+ success = True , message = "Success" , output_path = "out" , data = {}, errors = []
512+ )
507513 mock_list .return_value = []
508514 mock_view .return_value = MagicMock (success = True , message = "Success" , data = {})
509515
@@ -532,7 +538,8 @@ def test_interactive_mode_invalid(self, mock_cli_workflows):
532538
533539 def test_interactive_mode_sweep (self , mock_cli_workflows ):
534540 """Test selecting sweep workflow."""
535- with patch ("builtins.input" , side_effect = ["1" , "" , "" , "" , "" ]): # Select 1, then defaults for sweep
541+ # Select 1, then defaults for sweep
542+ with patch ("builtins.input" , side_effect = ["1" , "" , "" , "" , "" ]):
536543 assert _cli .interactive_mode () == 0
537544 mock_cli_workflows ["sweep" ].assert_called_once ()
538545
@@ -548,7 +555,9 @@ def test_interactive_sweep_defaults(self, mock_cli_workflows):
548555
549556 def test_interactive_sweep_custom (self , mock_cli_workflows ):
550557 """Test interactive sweep with custom inputs."""
551- with patch ("builtins.input" , side_effect = ["strat1, strat2" , "hard" , "1, 2" , "50" ]):
558+ with patch (
559+ "builtins.input" , side_effect = ["strat1, strat2" , "hard" , "1, 2" , "50" ]
560+ ):
552561 assert _cli .interactive_sweep () == 0
553562 args = mock_cli_workflows ["sweep" ].call_args [0 ][0 ]
554563 assert args .strategies == ["strat1" , "strat2" ]
@@ -558,7 +567,9 @@ def test_interactive_sweep_custom(self, mock_cli_workflows):
558567
559568 def test_interactive_compare_success (self , mock_cli_workflows ):
560569 """Test interactive compare workflow."""
561- with patch ("builtins.input" , side_effect = ["path/a" , "Name A" , "path/b" , "Name B" ]):
570+ with patch (
571+ "builtins.input" , side_effect = ["path/a" , "Name A" , "path/b" , "Name B" ]
572+ ):
562573 assert _cli .interactive_compare () == 0
563574 args = mock_cli_workflows ["compare" ].call_args [0 ][0 ]
564575 assert str (args .config_a_path ) == "path/a"
@@ -573,7 +584,10 @@ def test_interactive_compare_missing_path(self, mock_cli_workflows):
573584
574585 def test_interactive_tuning_success (self , mock_cli_workflows ):
575586 """Test interactive tuning workflow."""
576- with patch ("builtins.input" , side_effect = ["test_exp" , "economy.regen=1.5" , "invalid" , "flag=true" , "" ]):
587+ with patch (
588+ "builtins.input" ,
589+ side_effect = ["test_exp" , "economy.regen=1.5" , "invalid" , "flag=true" , "" ],
590+ ):
577591 assert _cli .interactive_tuning () == 0
578592 args = mock_cli_workflows ["tuning" ].call_args [0 ][0 ]
579593 assert args .name == "test_exp"
@@ -592,17 +606,32 @@ def test_interactive_view_reports_empty(self, mock_cli_workflows):
592606 def test_interactive_view_reports_select (self , mock_cli_workflows ):
593607 """Test selecting a report to view."""
594608 mock_cli_workflows ["list" ].return_value = [
595- {"timestamp" : "2023" , "completed_sweeps" : 1 , "total_sweeps" : 1 , "strategies" : ["s" ], "path" : "p" }
609+ {
610+ "timestamp" : "2023" ,
611+ "completed_sweeps" : 1 ,
612+ "total_sweeps" : 1 ,
613+ "strategies" : ["s" ],
614+ "path" : "p" ,
615+ }
596616 ]
597- mock_cli_workflows ["view" ].return_value .data = {"strategy_stats" : {"s" : {"avg_stability" : 0.5 }}}
617+ mock_cli_workflows ["view" ].return_value .data = {
618+ "strategy_stats" : {"s" : {"avg_stability" : 0.5 }}
619+ }
598620
599621 with patch ("builtins.input" , side_effect = ["1" ]):
600622 assert _cli .interactive_view_reports () == 0
601623 mock_cli_workflows ["view" ].assert_called_once ()
602624
603625 def test_interactive_view_reports_quit (self , mock_cli_workflows ):
604626 """Test quitting report viewer."""
605- mock_cli_workflows ["list" ].return_value = [{"timestamp" : "2023" , "completed_sweeps" : 1 , "total_sweeps" : 1 , "strategies" : ["s" ]}]
627+ mock_cli_workflows ["list" ].return_value = [
628+ {
629+ "timestamp" : "2023" ,
630+ "completed_sweeps" : 1 ,
631+ "total_sweeps" : 1 ,
632+ "strategies" : ["s" ],
633+ }
634+ ]
606635 with patch ("builtins.input" , side_effect = ["q" ]):
607636 assert _cli .interactive_view_reports () == 0
608637
@@ -666,7 +695,15 @@ def test_cmd_view_reports(self, mock_cli_workflows):
666695 args .limit = 5
667696 args .json = False
668697
669- mock_cli_workflows ["list" ].return_value = [{"timestamp" : "t" , "completed_sweeps" : 1 , "total_sweeps" : 1 , "strategies" : ["s" ], "path" : "p" }]
698+ mock_cli_workflows ["list" ].return_value = [
699+ {
700+ "timestamp" : "t" ,
701+ "completed_sweeps" : 1 ,
702+ "total_sweeps" : 1 ,
703+ "strategies" : ["s" ],
704+ "path" : "p" ,
705+ }
706+ ]
670707
671708 assert _cli .cmd_view_reports (args ) == 0
672709 mock_cli_workflows ["list" ].assert_called_once ()
0 commit comments