Skip to content

Commit 907a633

Browse files
committed
Remove unused using from testing and format
1 parent 4162a29 commit 907a633

19 files changed

+42
-68
lines changed

src/testing/arraytest.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using System.Collections;
3-
41
namespace Python.Test
52
{
63
//========================================================================
@@ -318,4 +315,4 @@ public static Spam[][] EchoRangeAA(Spam[][] items)
318315
return items;
319316
}
320317
}
321-
}
318+
}

src/testing/callbacktest.cs

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
1+
using Python.Runtime;
52

63
namespace Python.Test
74
{
@@ -13,32 +10,33 @@ public class CallbackTest
1310
{
1411
public string Call_simpleDefaultArg_WithNull(string moduleName)
1512
{
16-
using (Runtime.Py.GIL())
13+
using (Py.GIL())
1714
{
18-
dynamic module = Runtime.Py.Import(moduleName);
15+
dynamic module = Py.Import(moduleName);
1916
return module.simpleDefaultArg(null);
2017
}
2118
}
19+
2220
public string Call_simpleDefaultArg_WithEmptyArgs(string moduleName)
2321
{
24-
using (Runtime.Py.GIL())
22+
using (Py.GIL())
2523
{
26-
dynamic module = Runtime.Py.Import(moduleName);
24+
dynamic module = Py.Import(moduleName);
2725
return module.simpleDefaultArg();
2826
}
2927
}
3028
}
3129

3230
//==========================================================================
3331
// Tests calling from Python into C# and back into Python using a PyObject.
34-
// SelfCallbackTest should be inherited by a Python class.
32+
// SelfCallbackTest should be inherited by a Python class.
3533
// Used in test_class.py / testCallback
3634
//==========================================================================
3735
public class SelfCallbackTest
3836
{
39-
public void Callback(Runtime.PyObject self)
37+
public void Callback(PyObject self)
4038
{
41-
using (Runtime.Py.GIL())
39+
using (Py.GIL())
4240
((dynamic)self).PyCallback(self);
4341
}
4442
}

src/testing/classtest.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Collections;
32

43
namespace Python.Test
@@ -61,4 +60,4 @@ public ClassCtorTest2(string v)
6160
internal class InternalClass
6261
{
6362
}
64-
}
63+
}

src/testing/constructortests.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections;
32
using System.IO;
43

54
namespace Python.Test
@@ -50,4 +49,4 @@ public SubclassConstructorTest(Exception v)
5049
this.value = v;
5150
}
5251
}
53-
}
52+
}

src/testing/conversiontest.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
3-
41
namespace Python.Test
52
{
63
//========================================================================
@@ -58,4 +55,4 @@ public string GetValue()
5855
return value;
5956
}
6057
}
61-
}
58+
}

src/testing/delegatetest.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
31
namespace Python.Test
42
{
53
//========================================================================
@@ -60,4 +58,4 @@ public bool CallBoolDelegate(BoolDelegate d)
6058
return d();
6159
}
6260
}
63-
}
61+
}

src/testing/doctest.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ namespace Python.Test
88

99
// Classes with a constructor have their docstring set to the ctor signature.
1010
// Test if a class has an explicit doc string it gets set correctly.
11-
[DocStringAttribute("DocWithCtorTest Class")]
11+
[DocString("DocWithCtorTest Class")]
1212
public class DocWithCtorTest
1313
{
1414
public DocWithCtorTest()
1515
{
1616
}
1717

18-
[DocStringAttribute("DocWithCtorTest TestMethod")]
18+
[DocString("DocWithCtorTest TestMethod")]
1919
public void TestMethod()
2020
{
2121
}
2222

23-
[DocStringAttribute("DocWithCtorTest StaticTestMethod")]
23+
[DocString("DocWithCtorTest StaticTestMethod")]
2424
public static void StaticTestMethod()
2525
{
2626
}
@@ -41,17 +41,17 @@ public static void StaticTestMethod(double a, int b)
4141
}
4242
}
4343

44-
[DocStringAttribute("DocWithoutCtorTest Class")]
44+
[DocString("DocWithoutCtorTest Class")]
4545
public class DocWithoutCtorTest
4646
{
47-
[DocStringAttribute("DocWithoutCtorTest TestMethod")]
47+
[DocString("DocWithoutCtorTest TestMethod")]
4848
public void TestMethod()
4949
{
5050
}
5151

52-
[DocStringAttribute("DocWithoutCtorTest StaticTestMethod")]
52+
[DocString("DocWithoutCtorTest StaticTestMethod")]
5353
public static void StaticTestMethod()
5454
{
5555
}
5656
}
57-
}
57+
}

src/testing/enumtest.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public enum ULongEnum : ulong
8686
Five
8787
}
8888

89-
[FlagsAttribute]
89+
[Flags]
9090
public enum FlagsEnum
9191
{
9292
Zero,
@@ -96,4 +96,4 @@ public enum FlagsEnum
9696
Four,
9797
Five
9898
}
99-
}
99+
}

src/testing/exceptiontest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,4 @@ public string GetExtraInfo()
9999
return extra;
100100
}
101101
}
102-
}
102+
}

src/testing/fieldtest.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
3-
41
namespace Python.Test
52
{
63
//========================================================================
@@ -54,4 +51,4 @@ public void Shutup()
5451
public object ObjectField;
5552
public ISpam SpamField;
5653
}
57-
}
54+
}

src/testing/generictest.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using System.Collections;
3-
41
namespace Python.Test
52
{
63
//========================================================================
@@ -131,4 +128,4 @@ public static string Overloaded<Q>(int arg1, int arg2, string arg3)
131128
return arg3;
132129
}
133130
}
134-
}
131+
}

src/testing/globaltest.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
using System;
2-
31
//========================================================================
42
// Supports units tests for access to types without a namespace.
53
//========================================================================
64

75
public class NoNamespaceType
86
{
9-
}
7+
}

src/testing/indexertest.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Collections;
32

43
namespace Python.Test
@@ -415,4 +414,4 @@ public MultiDefaultKeyIndexerTest() : base()
415414
}
416415
}
417416
}
418-
}
417+
}

src/testing/interfacetest.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
31
namespace Python.Test
42
{
53
//========================================================================
@@ -62,4 +60,4 @@ private interface IPrivate
6260
{
6361
}
6462
}
65-
}
63+
}

src/testing/methodtest.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.IO;
3-
using System.Collections.Generic;
43

54
namespace Python.Test
65
{
@@ -156,13 +155,13 @@ public static bool TestValueRefParams(string s, ref int i1)
156155

157156
public static bool TestObjectOutParams(object o, out object o1)
158157
{
159-
o1 = new System.Exception("test");
158+
o1 = new Exception("test");
160159
return true;
161160
}
162161

163162
public static bool TestObjectRefParams(object o, ref object o1)
164163
{
165-
o1 = new System.Exception("test");
164+
o1 = new Exception("test");
166165
return true;
167166
}
168167

@@ -630,4 +629,4 @@ public string PublicMethod(string echo)
630629
return echo;
631630
}
632631
}
633-
}
632+
}

src/testing/moduletest.cs

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
using System;
22
using System.Threading;
33

4-
namespace Python.Test {
5-
public class ModuleTest {
4+
namespace Python.Test
5+
{
6+
public class ModuleTest
7+
{
68
private static Thread _thread;
79

810
public static void RunThreads()
911
{
10-
_thread = new Thread(() => {
12+
_thread = new Thread(() =>
13+
{
1114
var appdomain = AppDomain.CurrentDomain;
1215
var assemblies = appdomain.GetAssemblies();
13-
foreach (var assembly in assemblies) {
16+
foreach (var assembly in assemblies)
17+
{
1418
assembly.GetTypes();
1519
}
1620
});

src/testing/propertytest.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
31
namespace Python.Test
42
{
53
//========================================================================
@@ -84,4 +82,4 @@ public ShortEnum EnumProperty
8482
set { _enum_property = value; }
8583
}
8684
}
87-
}
85+
}

src/testing/subclasstest.cs

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
53

64
namespace Python.Test
75
{
@@ -70,7 +68,6 @@ public class SubClass : RecursiveInheritance
7068
{
7169
public void SomeMethod()
7270
{
73-
7471
}
7572
}
7673
}

src/testing/threadtest.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections;
32
using Python.Runtime;
43

54
namespace Python.Test
@@ -77,4 +76,4 @@ public static string CallEchoString2(string arg)
7776
}
7877
}
7978
}
80-
}
79+
}

0 commit comments

Comments
 (0)