File tree Expand file tree Collapse file tree 1 file changed +38
-6
lines changed
Expand file tree Collapse file tree 1 file changed +38
-6
lines changed Original file line number Diff line number Diff line change 2828 (base/init {:libpaths [" test/clojure_python/" ]})
2929 (class base/*interp*)))
3030
31+
32+ (defmacro with-test-interp [& body]
33+ `(base/with-interpreter
34+ {:libpaths [" test/clojure_python/" ]}
35+ ~@body))
36+
3137(fact " with-interpreter dynamically binds a new interpreter environment"
32- (base/with-interpreter
33- {:libpaths [" test/clojure_python/" ]}
34- base/*interp*)
38+ (with-test-interp base/*interp*)
3539 =not=>
36- (base/with-interpreter
37- {:libpaths [" test/clojure_python/" ]}
38- base/*interp*))
40+ (with-test-interp base/*interp*))
41+
42+ (fact " importing python modules works"
43+ (with-test-interp
44+ (base/py-import example)
45+ (class example))
46+ =>
47+ org.python.core.PyStringMap)
48+
49+ (fact " importing python functions works"
50+ (with-test-interp
51+ (base/py-import example)
52+ (base/import-fn example hello)
53+ (fn? hello))
54+ =>
55+ true )
56+
57+ (fact " calling python functions works"
58+ (with-test-interp
59+ (base/py-import example)
60+ (base/import-fn example hello)
61+ (hello " world" ))
62+ =>
63+ " hello, world how are you."
64+
65+ (with-test-interp
66+ (base/py-import example)
67+ ((base/py-fn example hello)
68+ " person" ))
69+ =>
70+ " hello, person how are you." )
You can’t perform that action at this time.
0 commit comments