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

Commit3960423

Browse files
committed
Moved the test to Python.
Added EmbeddedPythonTest with the capability to run any desired Python tests within NUnit.
1 parent29523f0 commit3960423

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
usingSystem;
22
usingSystem.Collections.Generic;
3+
usingSystem.IO;
34
usingSystem.Linq;
45
usingSystem.Reflection;
56
usingSystem.Text;
@@ -8,7 +9,7 @@
89

910
namespacePython.EmbeddingTest
1011
{
11-
publicclassTestList
12+
publicclassTestPythonTests
1213
{
1314
[OneTimeSetUp]
1415
publicvoidSetUp()
@@ -22,14 +23,21 @@ public void Dispose()
2223
PythonEngine.Shutdown();
2324
}
2425

25-
[Test]
26-
publicvoidMissingGenericTypeTest()
26+
staticIEnumerable<string[]>MyTestCases()
2727
{
28-
Assert.Throws<PythonException>(()=>
28+
yieldreturnnew[]{"test_generic","test_missing_generic_type"};
29+
}
30+
31+
[TestCaseSource(nameof(MyTestCases))]
32+
publicvoidEmbeddedPythonTest(stringtestFile,stringtestName)
33+
{
34+
stringfolder=@"..\\..\\..\\..\\tests";
2935
PythonEngine.Exec($@"
30-
from System.Collections import IList
31-
IList[bool]
32-
"));
36+
import sys
37+
sys.path.insert(0, '{folder}')
38+
from{testFile} import *
39+
{testName}()
40+
");
3341
}
3442
}
3543
}

‎src/tests/test_generic.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,3 +745,8 @@ def test_nested_generic_class():
745745
"""Check nested generic classes."""
746746
# TODO NotImplemented
747747
pass
748+
749+
deftest_missing_generic_type():
750+
fromSystem.CollectionsimportIList
751+
withpytest.raises(TypeError):
752+
IList[bool]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp