Skip to content

Commit 36f14b3

Browse files
committed
Python: Add explicit tests for kwargs
I also renamed the arguments to match what the keyword argument is called. It doesn't matter too much for these specific tests, but for the tests I'm about to add, it makes things a lot easier to get an overview of. Oh, and a test failure :O
1 parent 8260201 commit 36f14b3

File tree

1 file changed

+32
-18
lines changed

1 file changed

+32
-18
lines changed

python/ql/test/library-tests/frameworks/stdlib/FileSystemAccess.py

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
import io
33
import os
44

5-
open("filepath") # $ getAPathArgument="filepath"
6-
open(file="filepath") # $ getAPathArgument="filepath"
5+
open("file") # $ getAPathArgument="file"
6+
open(file="file") # $ getAPathArgument="file"
77

88
o = open
99

10-
o("filepath") # $ getAPathArgument="filepath"
11-
o(file="filepath") # $ getAPathArgument="filepath"
10+
o("file") # $ getAPathArgument="file"
11+
o(file="file") # $ getAPathArgument="file"
1212

1313

14-
builtins.open("filepath") # $ getAPathArgument="filepath"
15-
builtins.open(file="filepath") # $ getAPathArgument="filepath"
14+
builtins.open("file") # $ getAPathArgument="file"
15+
builtins.open(file="file") # $ getAPathArgument="file"
1616

1717

18-
io.open("filepath") # $ getAPathArgument="filepath"
19-
io.open(file="filepath") # $ getAPathArgument="filepath"
18+
io.open("file") # $ getAPathArgument="file"
19+
io.open(file="file") # $ getAPathArgument="file"
2020

2121
f = open("path") # $ getAPathArgument="path"
2222
f.write("foo") # $ getAPathArgument="path" fileWriteData="foo"
@@ -30,21 +30,35 @@ def through_function(open_file):
3030
through_function(f)
3131

3232
# os.path
33-
os.path.exists("filepath") # $ getAPathArgument="filepath"
34-
os.path.isfile("filepath") # $ getAPathArgument="filepath"
35-
os.path.isdir("filepath") # $ getAPathArgument="filepath"
36-
os.path.islink("filepath") # $ getAPathArgument="filepath"
37-
os.path.ismount("filepath") # $ getAPathArgument="filepath"
33+
os.path.exists("path") # $ getAPathArgument="path"
34+
os.path.exists(path="path") # $ getAPathArgument="path"
35+
36+
os.path.isfile("path") # $ getAPathArgument="path"
37+
os.path.isfile(path="path") # $ getAPathArgument="path"
38+
39+
os.path.isdir("s") # $ getAPathArgument="s"
40+
os.path.isdir(s="s") # $ MISSING: getAPathArgument="s"
41+
42+
os.path.islink("path") # $ getAPathArgument="path"
43+
os.path.islink(path="path") # $ getAPathArgument="path"
44+
45+
os.path.ismount("path") # $ getAPathArgument="path"
46+
os.path.ismount(path="path") # $ getAPathArgument="path"
3847

3948
# actual os.path implementations
4049
import posixpath
4150
import ntpath
4251
import genericpath
4352

44-
posixpath.exists("filepath") # $ getAPathArgument="filepath"
45-
ntpath.exists("filepath") # $ getAPathArgument="filepath"
46-
genericpath.exists("filepath") # $ getAPathArgument="filepath"
53+
posixpath.exists("path") # $ getAPathArgument="path"
54+
posixpath.exists(path="path") # $ getAPathArgument="path"
55+
56+
ntpath.exists("path") # $ getAPathArgument="path"
57+
ntpath.exists(path="path") # $ getAPathArgument="path"
58+
59+
genericpath.exists("path") # $ getAPathArgument="path"
60+
genericpath.exists(path="path") # $ getAPathArgument="path"
4761

4862
# os
49-
os.stat("filepath") # $ getAPathArgument="filepath"
50-
os.stat(path="filepath") # $ getAPathArgument="filepath"
63+
os.stat("path") # $ getAPathArgument="path"
64+
os.stat(path="path") # $ getAPathArgument="path"

0 commit comments

Comments
 (0)