summaryrefslogtreecommitdiff
path: root/tests/functional/c/consider/consider_using_with_open.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/c/consider/consider_using_with_open.py')
-rw-r--r--tests/functional/c/consider/consider_using_with_open.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/functional/c/consider/consider_using_with_open.py b/tests/functional/c/consider/consider_using_with_open.py
new file mode 100644
index 000000000..6e7cb04bd
--- /dev/null
+++ b/tests/functional/c/consider/consider_using_with_open.py
@@ -0,0 +1,15 @@
+# pylint: disable=missing-function-docstring, missing-module-docstring, invalid-name, import-outside-toplevel
+"""
+The functional test for the standard ``open()`` function has to be moved in a separate file,
+because PyPy has to be excluded for the tests as the ``open()`` function is uninferable in PyPy.
+However, all remaining checks for consider-using-with work in PyPy, so we do not want to exclude
+PyPy from ALL functional tests.
+"""
+
+
+def test_open():
+ fh = open("test.txt") # [consider-using-with]
+ fh.close()
+
+ with open("test.txt") as fh: # must not trigger
+ fh.read()