Skip to content

Commit 002e3d9

Browse files
authored
Update PythonFunctionTests.swift
1 parent 887af3a commit 002e3d9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Tests/PythonKitTests/PythonFunctionTests.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,20 @@ class PythonFunctionTests: XCTestCase {
8989
// `[String: PythonObject]`. To fix this error, we add a
9090
// `@_disfavoredOverload` attribute to the more specific initializer.
9191
func testPythonClassInitializer() {
92+
guard canUsePythonFunction else {
93+
return
94+
}
95+
96+
let MyClass = PythonClass(
97+
"MyClass",
98+
superclasses: [Python.object],
99+
members: [
100+
"memberName": "memberValue",
101+
]
102+
).pythonObject
92103

104+
let memberValue = MyClass().memberName
105+
XCTAssertEqual(String(memberValue), "memberValue")
93106
}
94107

95108
func testPythonClassInheritance() {

0 commit comments

Comments
 (0)