From 160274ed7b677b455ee8167d3f2b4e08fb3b4a19 Mon Sep 17 00:00:00 2001 From: pem70 Date: Thu, 20 Jun 2024 09:59:27 -0400 Subject: [PATCH] Update alcunit setter Signed-off-by: pem70 --- src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py | 4 ++-- tests/unit/files/datasets/test_create.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py index 5f3b1849..530f31fe 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/datasets.py @@ -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 @@ -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"): diff --git a/tests/unit/files/datasets/test_create.py b/tests/unit/files/datasets/test_create.py index af4e1ffe..9a69df12 100644 --- a/tests/unit/files/datasets/test_create.py +++ b/tests/unit/files/datasets/test_create.py @@ -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))