1414
1515from unittest .mock import MagicMock , patch
1616
17- from xcengine .core import ChunkStream , ImageBuilder
17+ from xcengine .core import ChunkStream , ImageBuilder , ScriptCreator
1818
1919
2020@patch ("xcengine.core.ScriptCreator.__init__" )
@@ -47,13 +47,13 @@ def test_image_builder_init(init_mock, tmp_path, tag):
4747 init_mock .assert_called_once_with (nb_path )
4848
4949
50- def test_init_runner_invalid_image_type ():
50+ def test_runner_init_invalid_image_type ():
5151 with pytest .raises (ValueError , match = 'Invalid type "int"' ):
5252 # noinspection PyTypeChecker
5353 xcengine .core .ContainerRunner (666 , pathlib .Path ("/foo" ))
5454
5555
56- def test_init_runner_with_string ():
56+ def test_runner_init_with_string ():
5757 image_name = "foo"
5858 image_mock = Mock (docker .models .images .Image )
5959 client_mock = Mock (docker .client .DockerClient )
@@ -69,7 +69,7 @@ def get_mock(name):
6969 assert image_mock == runner .image
7070
7171
72- def test_init_runner_with_image ():
72+ def test_runner_init_with_image ():
7373 runner = xcengine .core .ContainerRunner (
7474 image := Mock (docker .models .images .Image ), pathlib .Path ("/foo" )
7575 )
@@ -117,3 +117,13 @@ def test_chunk_stream():
117117 chunk_stream = ChunkStream (bytegen )
118118 assert chunk_stream .readable ()
119119 assert BufferedReader (chunk_stream ).read () == expected
120+
121+
122+ def test_script_creator_init ():
123+ script_creator = ScriptCreator (
124+ pathlib .Path (__file__ ).parent / "data" / "paramtest.ipynb"
125+ )
126+ assert script_creator .nb_params .params == {
127+ "parameter_1" : (int , 6 ),
128+ "parameter_2" : (str , "default value" ),
129+ }
0 commit comments