File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed
python/ql/test/library-tests/frameworks/toml Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ import python
2
+ import experimental.meta.ConceptsTest
Original file line number Diff line number Diff line change
1
+ import toml
2
+ from io import StringIO
3
+
4
+ encoded = 'title = "example"\n '
5
+ decoded = {"title" : "example" }
6
+
7
+ # LOADING
8
+ assert decoded == toml .loads (encoded ) # $ MISSING: decodeInput=encoded
9
+ assert decoded == toml .loads (s = encoded ) # $ MISSING: decodeInput=encoded
10
+
11
+ # this is not the official way to do things, but it works
12
+ assert decoded == toml .decoder .loads (encoded ) # $ MISSING: decodeInput=encoded
13
+
14
+ f_encoded = StringIO (encoded )
15
+ assert decoded == toml .load (f_encoded ) # $ MISSING: decodeInput=f_encoded
16
+
17
+ f_encoded = StringIO (encoded )
18
+ assert decoded == toml .load (f = f_encoded ) # $ MISSING: decodeInput=f_encoded
19
+
20
+ f_encoded = StringIO (encoded )
21
+ assert decoded == toml .decoder .load (f_encoded ) # $ MISSING: decodeInput=f_encoded
22
+
23
+ # DUMPING
24
+ assert encoded == toml .dumps (decoded ) # $ MISSING: encodeInput=decoded
25
+ assert encoded == toml .dumps (o = decoded ) # $ MISSING: encodeInput=decoded
26
+ assert encoded == toml .encoder .dumps (decoded ) # $ MISSING: encodeInput=decoded
27
+
28
+ f_encoded = StringIO ()
29
+ toml .dump (decoded , f_encoded ) # $ MISSING: encodeInput=decoded
30
+ assert encoded == f_encoded .getvalue ()
31
+
32
+ f_encoded = StringIO ()
33
+ toml .dump (o = decoded , f = f_encoded ) # $ MISSING: encodeInput=decoded
34
+ assert encoded == f_encoded .getvalue ()
35
+
36
+ f_encoded = StringIO ()
37
+ toml .encoder .dump (decoded , f_encoded ) # $ MISSING: encodeInput=decoded
38
+ assert encoded == f_encoded .getvalue ()
You can’t perform that action at this time.
0 commit comments