@@ -1101,30 +1101,30 @@ def test_find_sketches(capsys):
11011101
11021102 # Test sketch path is a sketch file
11031103 compile_sketches = get_compilesketches_object (
1104- sketch_paths = "\" " + str (test_data_path .joinpath ("HasSketches" , "Sketch1" , "Sketch1.ino" )) + "\" "
1104+ sketch_paths = "\' " + str (test_data_path .joinpath ("HasSketches" , "Sketch1" , "Sketch1.ino" )) + "\' "
11051105 )
11061106 assert compile_sketches .find_sketches () == [
11071107 test_data_path .joinpath ("HasSketches" , "Sketch1" )
11081108 ]
11091109
11101110 # Test sketch path is a non-sketch file
11111111 non_sketch_path = str (test_data_path .joinpath ("NoSketches" , "NotSketch" , "NotSketch.foo" ))
1112- compile_sketches = get_compilesketches_object (sketch_paths = "\" " + non_sketch_path + "\" " )
1112+ compile_sketches = get_compilesketches_object (sketch_paths = "\' " + non_sketch_path + "\' " )
11131113 with pytest .raises (expected_exception = SystemExit , match = "1" ):
11141114 compile_sketches .find_sketches ()
11151115 assert capsys .readouterr ().out .strip () == ("::error::Sketch path: " + non_sketch_path + " is not a sketch" )
11161116
11171117 # Test sketch path is a sketch folder
11181118 compile_sketches = get_compilesketches_object (
1119- sketch_paths = "\" " + str (test_data_path .joinpath ("HasSketches" , "Sketch1" )) + "\" "
1119+ sketch_paths = "\' " + str (test_data_path .joinpath ("HasSketches" , "Sketch1" )) + "\' "
11201120 )
11211121 assert compile_sketches .find_sketches () == [
11221122 test_data_path .joinpath ("HasSketches" , "Sketch1" )
11231123 ]
11241124
11251125 # Test sketch path does contain sketches
11261126 compile_sketches = get_compilesketches_object (
1127- sketch_paths = "\" " + str (test_data_path .joinpath ("HasSketches" )) + "\" " )
1127+ sketch_paths = "\' " + str (test_data_path .joinpath ("HasSketches" )) + "\' " )
11281128 assert compile_sketches .find_sketches () == [
11291129 test_data_path .joinpath ("HasSketches" , "Sketch1" ),
11301130 test_data_path .joinpath ("HasSketches" , "Sketch2" )
@@ -1133,13 +1133,27 @@ def test_find_sketches(capsys):
11331133 # Test sketch path doesn't contain any sketches
11341134 no_sketches_path = str (test_data_path .joinpath ("NoSketches" ))
11351135 compile_sketches = get_compilesketches_object (
1136- sketch_paths = "\" " + no_sketches_path + "\" " )
1136+ sketch_paths = "\' " + no_sketches_path + "\' " )
11371137 with pytest .raises (expected_exception = SystemExit , match = "1" ):
11381138 compile_sketches .find_sketches ()
11391139 assert capsys .readouterr ().out .strip () == ("::error::No sketches were found in "
11401140 + no_sketches_path )
11411141
11421142
1143+ @pytest .mark .parametrize (
1144+ "input_value, expected_list, expected_was_yaml_list" ,
1145+ [("" , [], False ),
1146+ ("foo" , ["foo" ], False ),
1147+ ("\' \" foo bar\" baz\' " , ["foo bar" , "baz" ], False ),
1148+ ("foo: bar" , ["foo:" , "bar" ], False ),
1149+ ("-" , [None ], True ),
1150+ ("- foo: asdf\n bar: qwer\n - baz: zxcv" , [{"foo" : "asdf" , "bar" : "qwer" }, {"baz" : "zxcv" }], True )])
1151+ def test_get_list_from_multiformat_input (input_value , expected_list , expected_was_yaml_list ):
1152+ input_list = compilesketches .get_list_from_multiformat_input (input_value = input_value )
1153+ assert input_list .value == expected_list
1154+ assert input_list .was_yaml_list == expected_was_yaml_list
1155+
1156+
11431157def test_path_is_sketch ():
11441158 # Sketch file
11451159 assert compilesketches .path_is_sketch (path = test_data_path .joinpath ("HasSketches" , "Sketch1" , "Sketch1.ino" )) is True
0 commit comments