-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #318 from pyiron/test_checks_separately
Test checks separately
- Loading branch information
Showing
4 changed files
with
88 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import unittest | ||
|
||
from pympipool.shared.inputcheck import ( | ||
check_command_line_argument_lst, | ||
check_gpus_per_worker, | ||
check_threads_per_core, | ||
check_oversubscribe, | ||
check_executor, | ||
check_backend, | ||
check_init_function, | ||
check_refresh_rate, | ||
check_resource_dict, | ||
check_resource_dict_is_empty, | ||
) | ||
|
||
|
||
class TestInputCheck(unittest.TestCase): | ||
def test_check_command_line_argument_lst(self): | ||
with self.assertRaises(ValueError): | ||
check_command_line_argument_lst(command_line_argument_lst=["a"]) | ||
|
||
def test_check_gpus_per_worker(self): | ||
with self.assertRaises(TypeError): | ||
check_gpus_per_worker(gpus_per_worker=1) | ||
|
||
def test_check_threads_per_core(self): | ||
with self.assertRaises(TypeError): | ||
check_threads_per_core(threads_per_core=2) | ||
|
||
def test_check_oversubscribe(self): | ||
with self.assertRaises(ValueError): | ||
check_oversubscribe(oversubscribe=True) | ||
|
||
def test_check_executor(self): | ||
with self.assertRaises(ValueError): | ||
check_executor(executor=1) | ||
|
||
def test_check_backend(self): | ||
with self.assertRaises(ValueError): | ||
check_backend(backend="test") | ||
|
||
def test_check_init_function(self): | ||
with self.assertRaises(ValueError): | ||
check_init_function(init_function=1, block_allocation=False) | ||
|
||
def test_check_refresh_rate(self): | ||
with self.assertRaises(ValueError): | ||
check_refresh_rate(refresh_rate=1) | ||
|
||
def test_check_resource_dict(self): | ||
def simple_function(resource_dict): | ||
return resource_dict | ||
|
||
with self.assertRaises(ValueError): | ||
check_resource_dict(function=simple_function) | ||
|
||
def test_check_resource_dict_is_empty(self): | ||
with self.assertRaises(ValueError): | ||
check_resource_dict_is_empty(resource_dict={"a": 1}) |