1010
1111class MockComponent (ComponentBase ):
1212 def run (self ):
13- return ' run_executed'
13+ return " run_executed"
1414
1515
1616class MockComponentFail (ComponentBase ):
@@ -19,44 +19,40 @@ def run(self):
1919
2020
2121class TestCommonInterface (unittest .TestCase ):
22-
2322 def setUp (self ):
24- path = os .path .join (os .path .dirname (os .path .realpath (__file__ )),
25- 'data_examples' , 'data1' )
23+ path = os .path .join (os .path .dirname (os .path .realpath (__file__ )), "data_examples" , "data1" )
2624 os .environ ["KBC_DATADIR" ] = path
2725
2826 def test_default_arguments_pass (self ):
2927 MockComponent ()
3028
3129 def test_missing_config_parameters_fail (self ):
3230 with self .assertRaises (UserException ):
33- MockComponent (required_parameters = [' missing' ])
31+ MockComponent (required_parameters = [" missing" ])
3432
3533 def test_missing_image_parameters_fail (self ):
3634 with self .assertRaises (UserException ):
37- c = MockComponent (required_image_parameters = [' missing' ])
35+ c = MockComponent (required_image_parameters = [" missing" ])
3836 c .execute_action ()
3937
4038 def test_missing_action_fail (self ):
41- path = os .path .join (os .path .dirname (os .path .realpath (__file__ )),
42- 'data_examples' , 'data_custom_action' )
39+ path = os .path .join (os .path .dirname (os .path .realpath (__file__ )), "data_examples" , "data_custom_action" )
4340 os .environ ["KBC_DATADIR" ] = path
4441 with self .assertRaises (AttributeError ):
4542 MockComponent ().execute_action ()
4643
4744 def test_run_action_passes (self ):
48- self .assertEqual (MockComponent ().execute_action (), ' run_executed' )
45+ self .assertEqual (MockComponent ().execute_action (), " run_executed" )
4946
5047 def test_custom_action_passes (self ):
51- path = os .path .join (os .path .dirname (os .path .realpath (__file__ )),
52- 'data_examples' , 'data_custom_action' )
48+ path = os .path .join (os .path .dirname (os .path .realpath (__file__ )), "data_examples" , "data_custom_action" )
5349 os .environ ["KBC_DATADIR" ] = path
5450
5551 class CustomActionComponent (ComponentBase ):
5652 def run (self ):
5753 pass
5854
59- @sync_action (' custom_action' )
55+ @sync_action (" custom_action" )
6056 def test_action (self ):
6157 return [SelectElement ("test" )]
6258
@@ -68,40 +64,37 @@ def test_run_action_fails_with_user_error(self):
6864
6965 def test_system_action_name_fail (self ):
7066 with self .assertRaises (ValueError ):
67+
7168 class ComponentInvalidActionName (ComponentBase ):
7269 def run (self ):
7370 pass
7471
75- @sync_action (' run' )
72+ @sync_action (" run" )
7673 def test_action (self ):
7774 pass
7875
79- path = os .path .join (os .path .dirname (os .path .realpath (__file__ )),
80- 'data_examples' , 'data_custom_action' )
76+ path = os .path .join (os .path .dirname (os .path .realpath (__file__ )), "data_examples" , "data_custom_action" )
8177 os .environ ["KBC_DATADIR" ] = path
8278
8379 ComponentInvalidActionName ().execute_action ()
8480
85- @patch (' sys.stdout' , new_callable = StringIO )
81+ @patch (" sys.stdout" , new_callable = StringIO )
8682 def test_sync_action_prints_valid_message (self , stdout ):
87- path = os .path .join (os .path .dirname (os .path .realpath (__file__ )),
88- 'data_examples' , 'data_custom_action' )
83+ path = os .path .join (os .path .dirname (os .path .realpath (__file__ )), "data_examples" , "data_custom_action" )
8984 os .environ ["KBC_DATADIR" ] = path
9085
9186 class CustomActionComponent (ComponentBase ):
9287 def run (self ):
9388 pass
9489
95- @sync_action (' custom_action' )
90+ @sync_action (" custom_action" )
9691 def get_columns (self ):
97- return [SelectElement ("value_a" , "label_a" ),
98- SelectElement ("value_b" )
99- ]
92+ return [SelectElement ("value_a" , "label_a" ), SelectElement ("value_b" )]
10093
10194 CustomActionComponent ().execute_action ()
10295 expected = '[{"value": "value_a", "label": "label_a"}, {"value": "value_b", "label": "value_b"}]'
10396 self .assertEqual (stdout .getvalue (), expected )
10497
10598
106- if __name__ == ' __main__' :
99+ if __name__ == " __main__" :
107100 unittest .main ()
0 commit comments