summaryrefslogtreecommitdiffstatshomepage
path: root/tests/cpydiff/modules_os_getenv_argcount.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cpydiff/modules_os_getenv_argcount.py')
-rw-r--r--tests/cpydiff/modules_os_getenv_argcount.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/cpydiff/modules_os_getenv_argcount.py b/tests/cpydiff/modules_os_getenv_argcount.py
new file mode 100644
index 0000000000..375cf614b2
--- /dev/null
+++ b/tests/cpydiff/modules_os_getenv_argcount.py
@@ -0,0 +1,13 @@
+"""
+categories: Modules,os
+description: ``getenv`` only allows one argument
+cause: Unknown
+workaround: Test that the return value is ``None``
+"""
+import os
+try:
+ print(os.getenv('NEW_VARIABLE', 'DEFAULT'))
+except TypeError:
+ print('should not get here')
+ # this assumes NEW_VARIABLE is never an empty variable
+ print(os.getenv('NEW_VARIABLE') or 'DEFAULT')