-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
######################################################################### | ||
# test_common.py - common utility tests | ||
######################################################################### | ||
# Copyright (C) 2023 Toni Harzendorf <[email protected]> | ||
# Copyright (C) 2025 Toni Harzendorf <[email protected]> | ||
# | ||
# This file is part of PySlurm | ||
# | ||
|
@@ -108,6 +108,25 @@ def test_str_to_dict(self): | |
assert cstr.to_dict(input_str) == expected_dict | ||
assert cstr.to_dict("") == {} | ||
|
||
expected_dict = {"param1": True, "param2": "opt1", "param3": True} | ||
input_str = "param1,param2=opt1,param3" | ||
assert cstr.to_dict(input_str, delim1=",", delim2="=", def_value=True) | ||
|
||
expected_dict = {"license1": 1, "license2": 5, "license3": 20} | ||
input_str = "license1,license2:5,license3:20" | ||
assert cstr.to_dict(input_str, delim1=",", delim2=":", def_value=1) | ||
|
||
def test_str_to_list(self): | ||
expected_list = ["val1", "val2", "val3"] | ||
input_str = "val1,val2,val3" | ||
assert cstr.to_list(input_str) == expected_list | ||
|
||
expected_list = ["/path/to/dir1", "/path/to/dir2"] | ||
input_str = "/path/to/dir1:/path/to/dir2" | ||
assert cstr.to_list(input_str, default=None, delim=":") == expected_list | ||
|
||
assert cstr.to_list("") == [] | ||
|
||
def test_dict_to_str(self): | ||
input_dict = {"key1": "value1", "key2": "value2"} | ||
expected_str = "key1=value1,key2=value2" | ||
|
@@ -255,32 +274,6 @@ def test_set_parse_bool_flag(self): | |
assert not part.allow_root_jobs | ||
|
||
|
||
# def _uint_bool_impl(self, arg): | ||
# js = JobSubmitDescription() | ||
|
||
# setattr(js, arg, True) | ||
# assert getattr(js, arg) == True | ||
|
||
# setattr(js, arg, False) | ||
# assert getattr(js, arg) == False | ||
|
||
# # Set to true again to make sure toggling actually works. | ||
# setattr(js, arg, True) | ||
# assert getattr(js, arg) == True | ||
|
||
# setattr(js, arg, None) | ||
# assert getattr(js, arg) == False | ||
|
||
# def test_u8_bool(self): | ||
# self._uint_bool_impl("overcommit") | ||
|
||
# def test_u16_bool(self): | ||
# self._uint_bool_impl("requires_contiguous_nodes") | ||
|
||
# def test_u64_bool_flag(self): | ||
# self._uint_bool_impl("kill_on_invalid_dependency") | ||
|
||
|
||
class TestTime: | ||
|
||
def test_parse_minutes(self): | ||
|