Skip to content

Commit fc1fa51

Browse files
committed
Update py macro test fixture with realistic patterns
1 parent 6fb4f8e commit fc1fa51

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed
Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
(ns clj-kondo.fixtures.py-dot-test
2-
(:require [libpython-clj2.python :refer [py. py.. py.- py* py**]]))
3-
4-
(defn test-py-macros []
5-
(let [obj {:foo "bar"}]
6-
(py. obj method arg1 arg2)
7-
(py.. obj method1 method2 method3)
8-
(py.- obj attribute)
9-
(py* callable [arg1 arg2])
10-
(py** callable [arg1] {:kwarg1 val1})))
2+
(:require [libpython-clj2.python :as py :refer [py. py.. py.-]]))
3+
4+
(defn test-py-macros [obj serialization padding hashes Fernet rsa]
5+
;; py.. chained method calls
6+
(py.. Fernet generate_key decode)
7+
8+
;; py.. with attribute access using - prefix
9+
(py.. serialization -Encoding -PEM)
10+
11+
;; py.. method call with keyword args then chained
12+
(py.. obj (private_bytes
13+
:encoding (py.. serialization -Encoding -PEM)
14+
:format (py.. serialization -PrivateFormat -PKCS8))
15+
decode)
16+
17+
;; py.. with nested method calls
18+
(py.. padding (OAEP
19+
:mgf (py.. padding (MGF1 :algorithm (py.. hashes SHA256)))
20+
:algorithm (py.. hashes SHA1)
21+
:label nil))
22+
23+
;; py.. generate and chain
24+
(py.. rsa (generate_private_key :public_exponent 65537 :key_size 2048))
25+
26+
;; py. single method call
27+
(py. obj method arg1 arg2)
28+
29+
;; py.- attribute access
30+
(py.- obj some_attribute))

0 commit comments

Comments
 (0)