def test_attribute_expand_env(self) -> None: """Test transparent environment variable expansion.""" os.environ['CMDKIT_TEST_A'] = 'foo-bar' ns = Namespace({'test_env': 'CMDKIT_TEST_A'}) assert ns.get('test') is None assert ns.get('test_env') == 'CMDKIT_TEST_A' assert ns.test == 'foo-bar'
def test_attribute_expand_eval(self) -> None: """Test transparent shell expression expansion.""" ns = Namespace({'test_eval': 'echo foo-bar'}) assert ns.get('test') is None assert ns.get('test_eval') == 'echo foo-bar' assert ns.test == 'foo-bar'
def test_get(self) -> None: """Test Namespace[], Namespace.get().""" ns = Namespace(DATA) for key, value in zip(KEYS, VALUES): assert ns[key] == ns.get(key) == value assert ns.get(f'{key}_', False) is False