Skip to content

Commit

Permalink
Update alcunit setter
Browse files Browse the repository at this point in the history
Signed-off-by: pem70 <[email protected]>
  • Loading branch information
pem70 committed Jun 20, 2024
1 parent 0c5eb3c commit 160274e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def __init__(
self.dirblk = dirblk
self.avgblk = avgblk
self.recfm = recfm
self.blksize = blksize
self.lrecl = lrecl
self.blksize = blksize
self.storclass = storclass
self.mgntclass = mgntclass
self.dataclass = dataclass
Expand Down Expand Up @@ -92,7 +92,7 @@ def alcunit(self) -> Optional[str]:
def alcunit(self, alcunit: Optional[str]):
if alcunit is None:
if self.like is not None:
self.alcunit = None
self.__alcunit = None
else:
self.__alcunit = "TRK"
elif alcunit not in ("CYL", "TRK"):
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/files/datasets/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,12 @@ def test_create_data_set_without_options(self):
with self.assertRaises(ValueError) as error:
Files(self.test_profile).create_data_set("DSNAME123")
self.assertTrue("dataset options" in str(error.exception))

def test_DatasetOption_alcunit_setter(self):
options = DatasetOption(like="test")
self.assertEqual(options.alcunit, None)
options = DatasetOption()
self.assertEqual(options.alcunit, "TRK")
with self.assertRaises(KeyError) as error:
options.alcunit = "test"
self.assertTrue("'alcunit' must be 'CYL' or 'TRK'" in str(error.exception))

0 comments on commit 160274e

Please sign in to comment.