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

Commite7c94df

Browse files
committed
Clean-up embedded tests
Clean-up embedded tests comments and variable typesRemove TestFixture attribute. Optional since NUnit 2.5https://nunit.org/index.php?p=testFixture&r=2.6.4
1 parent04ce393 commite7c94df

File tree

8 files changed

+23
-21
lines changed

8 files changed

+23
-21
lines changed

‎src/embed_tests/dynamic.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
namespacePython.EmbeddingTest
77
{
8-
[TestFixture]
98
publicclassdynamicTest
109
{
1110
privatePy.GILStategil;
@@ -23,16 +22,16 @@ public void TearDown()
2322
}
2423

2524
/// <summary>
26-
/// Set the attribute of apyobject with a .NET object.
25+
/// Set the attribute of aPyObject with a .NET object.
2726
/// </summary>
2827
[Test]
2928
publicvoidAssignObject()
3029
{
31-
StringBuilderstream=newStringBuilder();
30+
varstream=newStringBuilder();
3231
dynamicsys=Py.Import("sys");
3332
sys.testattr=stream;
3433
// Check whether there are the same object.
35-
var_stream=sys.testattr.AsManagedObject(typeof(StringBuilder));
34+
dynamic_stream=sys.testattr.AsManagedObject(typeof(StringBuilder));
3635
Assert.AreEqual(_stream,stream);
3736

3837
PythonEngine.RunSimpleString(
@@ -42,7 +41,7 @@ public void AssignObject()
4241
}
4342

4443
/// <summary>
45-
/// Set the attribute of apyobject to null.
44+
/// Set the attribute of aPyObject to null.
4645
/// </summary>
4746
[Test]
4847
publicvoidAssignNone()
@@ -76,24 +75,24 @@ public void AssignPyObject()
7675
[Test]
7776
publicvoidPassObjectInPython()
7877
{
79-
StringBuilderstream=newStringBuilder();
78+
varstream=newStringBuilder();
8079
dynamicsys=Py.Import("sys");
8180
sys.testattr1=stream;
8281

83-
//Pass the .NET object in Python side
82+
//Pass the .NET object in Python side
8483
PythonEngine.RunSimpleString(
8584
"import sys\n"+
8685
"sys.testattr2 = sys.testattr1\n"
8786
);
8887

89-
//Compare in Python
88+
//Compare in Python
9089
PythonEngine.RunSimpleString(
9190
"import sys\n"+
9291
"sys.testattr3 = sys.testattr1 is sys.testattr2\n"
9392
);
9493
Assert.AreEqual(sys.testattr3.ToString(),"True");
9594

96-
//Compare in .NET
95+
//Compare in .NET
9796
Assert.AreEqual(sys.testattr1,sys.testattr2);
9897
}
9998

@@ -103,19 +102,19 @@ public void PassObjectInPython()
103102
[Test]
104103
publicvoidPassPyObjectInNet()
105104
{
106-
StringBuilderstream=newStringBuilder();
105+
varstream=newStringBuilder();
107106
dynamicsys=Py.Import("sys");
108107
sys.testattr1=stream;
109108
sys.testattr2=sys.testattr1;
110109

111-
//Compare in Python
110+
//Compare in Python
112111
PyObjectres=PythonEngine.RunString(
113112
"import sys\n"+
114113
"sys.testattr3 = sys.testattr1 is sys.testattr2\n"
115114
);
116115
Assert.AreEqual(sys.testattr3.ToString(),"True");
117116

118-
//Compare in .NET
117+
//Compare in .NET
119118
Assert.AreEqual(sys.testattr1,sys.testattr2);
120119
}
121120
}

‎src/embed_tests/pyimport.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ namespace Python.EmbeddingTest
1717
/// | | - __init__.py
1818
/// | | - one.py
1919
/// </remarks>
20-
[TestFixture]
2120
publicclassPyImportTest
2221
{
2322
privateIntPtrgs;

‎src/embed_tests/pyinitialize.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
usingSystem;
12
usingNUnit.Framework;
23
usingPython.Runtime;
34

@@ -51,24 +52,24 @@ public static void LoadSpecificArgs()
5152
//[Ignore("System.ArgumentException : Cannot pass a GCHandle across AppDomains")]
5253
publicvoidReInitialize()
5354
{
54-
stringcode="from System import Int32\n";
55+
varcode="from System import Int32\n";
5556
PythonEngine.Initialize();
5657
using(Py.GIL())
5758
{
58-
//import any class or struct from .NET
59+
// Import any class or struct from .NET
5960
PythonEngine.RunSimpleString(code);
6061
}
6162
PythonEngine.Shutdown();
6263

6364
PythonEngine.Initialize();
6465
using(Py.GIL())
6566
{
66-
//Import a class/struct from .NET
67-
//This class/struct must be imported during the first initialization.
67+
//Import a class/struct from .NET
68+
//This class/struct must be imported during the first initialization.
6869
PythonEngine.RunSimpleString(code);
69-
//Create an instance of the class/struct
70-
//System.OverflowException Exception will be raised here.
71-
//If replacing int with Int64, OverflowException will be replaced with AppDomain exception.
70+
//Create an instance of the class/struct
71+
//System.OverflowException Exception will be raised here.
72+
//If replacing int with Int64, OverflowException will be replaced with AppDomain exception.
7273
PythonEngine.RunSimpleString("Int32(1)");
7374
}
7475
PythonEngine.Shutdown();

‎src/embed_tests/pyiter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
usingSystem;
12
usingSystem.Collections.Generic;
23
usingNUnit.Framework;
34
usingPython.Runtime;

‎src/embed_tests/pylong.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
usingSystem;
12
usingNUnit.Framework;
23
usingPython.Runtime;
34

‎src/embed_tests/pyobject.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
usingSystem;
12
usingNUnit.Framework;
23
usingPython.Runtime;
34

‎src/embed_tests/pythonexception.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ namespace Python.EmbeddingTest
1111
/// Keeping this in the old-style SetUp/TearDown
1212
/// to ensure that setup still works.
1313
/// </remarks>
14-
[TestFixture]
1514
publicclassPythonExceptionTest
1615
{
1716
privateIntPtrgs;

‎src/embed_tests/pytuple.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
usingSystem;
12
usingNUnit.Framework;
23
usingPython.Runtime;
34

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp