11
22import pytest
33
4- from psij import JobSpec
4+ from psij import JobSpec , JobExecutor , Job
55
66
7- def test_environment_types () -> None :
7+ def _test_spec (spec : JobSpec ) -> None :
8+ ex = JobExecutor .get_instance ('local' )
9+ ex .submit (Job (spec ))
810
9- with pytest .raises (TypeError ):
10- JobSpec (environment = {'foo' : 1 }) # type: ignore
1111
12+ def test_environment_types () -> None :
1213 with pytest .raises (TypeError ):
13- JobSpec (environment = {1 : 'foo' }) # type: ignore
14+ _test_spec ( JobSpec (environment = {'foo' : 1 })) # type: ignore
1415
1516 with pytest .raises (TypeError ):
16- spec = JobSpec ()
17- spec .environment = {'foo' : 1 } # type: ignore
17+ _test_spec (JobSpec (environment = {1 : 'foo' })) # type: ignore
1818
1919 with pytest .raises (TypeError ):
2020 spec = JobSpec ()
2121 spec .environment = {'foo' : 'bar' }
22- spec .environment ['buz' ] = 2 # type: ignore
22+ spec .environment ['buz' ] = 2 # type: ignore
23+ _test_spec (spec )
2324
2425 spec = JobSpec ()
2526 assert spec .environment is None
2627
2728 spec = JobSpec (environment = {'foo' : 'bar' })
28- assert spec .environment ['foo' ] == 'bar' # type: ignore
29+ assert spec .environment ['foo' ] == 'bar' # type: ignore
2930
3031 spec = JobSpec ()
3132 spec .environment = {'foo' : 'bar' }
@@ -34,4 +35,5 @@ def test_environment_types() -> None:
3435 spec .environment = {'foo' : 'biz' }
3536 assert spec .environment ['foo' ] == 'biz'
3637
38+
3739test_environment_types ()
0 commit comments