Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitae8e6f0

Browse files
committed
Add test for pyscript global variable casting
Test forpythonnet#420
1 parent8ce4e0e commitae8e6f0

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# -*- coding: utf-8 -*-
2+
3+
FOO=1
4+
5+
6+
deftest_foo():
7+
returnFOO

‎src/embed_tests/pyimport.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,20 @@ public void TestSysArgsImportException()
6464
PyObjectmodule=PythonEngine.ImportModule("PyImportTest.sysargv");
6565
Assert.IsNotNull(module);
6666
}
67+
68+
/// <summary>
69+
/// Test Global Variable casting. GH#420
70+
/// </summary>
71+
[Test]
72+
publicvoidTestCastGlobalVar()
73+
{
74+
dynamicfoo=Py.Import("PyImportTest.cast_global_var");
75+
Assert.AreEqual("1",foo.FOO.ToString());
76+
Assert.AreEqual("1",foo.test_foo().ToString());
77+
78+
foo.FOO=2;
79+
Assert.AreEqual("2",foo.FOO.ToString());
80+
Assert.AreEqual("2",foo.test_foo().ToString());
81+
}
6782
}
6883
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp