We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 50df11d + e531f3a commit 7cdbc2aCopy full SHA for 7cdbc2a
Tests/PythonKitTests/PythonRuntimeTests.swift
@@ -326,4 +326,22 @@ class PythonRuntimeTests: XCTestCase {
326
}
327
XCTAssertEqual(bytes, otherBytes)
328
329
+
330
+ func testPythonFunction() {
331
+ let versionMajor = Python.versionInfo.major
332
+ let versionMinor = Python.versionInfo.minor
333
+ guard (versionMajor == 3 && versionMinor >= 1) || versionMajor > 3 else {
334
+ return
335
+ }
336
337
+ let pythonAdd = PythonFunction { (params: [PythonObject]) in
338
+ let lhs = params[0]
339
+ let rhs = params[1]
340
+ return lhs + rhs
341
+ }.pythonObject
342
343
+ let pythonSum = pythonAdd(2, 3)
344
+ XCTAssertNotNil(Double(pythonSum))
345
+ XCTAssertEqual(pythonSum, 5)
346
347
0 commit comments