def test_missing_tuple_with_default_tuple(self): self.assertEqual(envar('TOWEL', tuple, '("forty","two")'), ('forty', 'two'))
def test_missing_tuple_with_default_tuple_without_parens(self): self.assertEqual(envar('TOWEL', tuple, '"forty","two"'), ('forty', 'two'))
def test_missing_str_with_default_str(self): self.assertEqual(envar('TOWEL', str, 'here'), 'here')
def test_missing_bool_with_default_bool(self): self.assertEqual(envar('TOWEL', bool, 'True'), True)
def test_missing_int_with_default_int(self): self.assertEqual(envar('TOWEL', int, '42'), 42)
def test_env_var_available_with_default_verbose(self): os.environ['LEWOT'] = '42' self.assertEqual(envar('LEWOT', int, '24', verbose=True), 42)
def test_env_var_available_with_no_default(self): os.environ['LEWOT'] = '42' self.assertEqual(envar('LEWOT', int), 42)