| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,15 +18,13 @@ public void SetUp() | |||
| 18 | 18 | PythonEngine.Initialize(); | |
| 19 | 19 | gs = PythonEngine.AcquireLock(); | |
| 20 | 20 | ||
| 21 | - /* | ||
| 22 | - * Append the tests directory to sys.path | ||
| 23 | - * using reflection to circumvent the private modifiers placed on most Runtime methods. | ||
| 21 | + /* Append the tests directory to sys.path | ||
| 22 | + * using reflection to circumvent the private | ||
| 23 | + * modifiers placed on most Runtime methods. | ||
| 24 | 24 | */ | |
| 25 | 25 | const string s = @"../../../../tests"; | |
| 26 | 26 | ||
| 27 | - var testPath = Path.Combine( | ||
| 28 | - TestContext.CurrentContext.TestDirectory, s | ||
| 29 | - ); | ||
| 27 | + string testPath = Path.Combine(TestContext.CurrentContext.TestDirectory, s); | ||
| 30 | 28 | ||
| 31 | 29 | IntPtr str = Runtime.Runtime.PyString_FromString(testPath); | |
| 32 | 30 | IntPtr path = Runtime.Runtime.PySys_GetObject("path"); | |
@@ -44,13 +42,12 @@ public void TearDown() | |||
| 44 | 42 | /// Test subdirectory import | |
| 45 | 43 | /// </summary> | |
| 46 | 44 | /// <remarks> | |
| 47 | - /// The required directory structure was added to the \trunk\pythonnet\src\tests directory: | ||
| 48 | - /// | ||
| 49 | - /// PyImportTest/ | ||
| 50 | - /// __init__.py | ||
| 51 | - /// test/ | ||
| 52 | - /// __init__.py | ||
| 53 | - /// one.py | ||
| 45 | + /// The required directory structure was added to .\pythonnet\src\tests\ directory: | ||
| 46 | + /// + PyImportTest/ | ||
| 47 | + /// | - __init__.py | ||
| 48 | + /// | + test/ | ||
| 49 | + /// | | - __init__.py | ||
| 50 | + /// | | - one.py | ||
| 54 | 51 | /// </remarks> | |
| 55 | 52 | [Test] | |
| 56 | 53 | public void TestDottedName() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,11 +27,11 @@ public void TearDown() | |||
| 27 | 27 | [Test] | |
| 28 | 28 | public void TestOnPyList() | |
| 29 | 29 | { | |
| 30 | - PyList list = new PyList(); | ||
| 30 | + var list = new PyList(); | ||
| 31 | 31 | list.Append(new PyString("foo")); | |
| 32 | 32 | list.Append(new PyString("bar")); | |
| 33 | 33 | list.Append(new PyString("baz")); | |
| 34 | - List<string> result = new List<string>(); | ||
| 34 | + var result = new List<string>(); | ||
| 35 | 35 | foreach (PyObject item in list) | |
| 36 | 36 | { | |
| 37 | 37 | result.Add(item.ToString()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,7 +26,7 @@ public void TearDown() | |||
| 26 | 26 | [Test] | |
| 27 | 27 | public void TestMessage() | |
| 28 | 28 | { | |
| 29 | - PyList list = new PyList(); | ||
| 29 | + var list = new PyList(); | ||
| 30 | 30 | try | |
| 31 | 31 | { | |
| 32 | 32 | PyObject junk = list[0]; | |
@@ -40,7 +40,7 @@ public void TestMessage() | |||
| 40 | 40 | [Test] | |
| 41 | 41 | public void TestNoError() | |
| 42 | 42 | { | |
| 43 | - PythonException e = new PythonException(); //There is no PyErr to fetch | ||
| 43 | + var e = new PythonException(); //There is no PyErr to fetch | ||
| 44 | 44 | Assert.AreEqual("", e.Message); | |
| 45 | 45 | } | |
| 46 | 46 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,7 +37,9 @@ public class SelfCallbackTest | |||
| 37 | 37 | public void Callback(PyObject self) | |
| 38 | 38 | { | |
| 39 | 39 | using (Py.GIL()) | |
| 40 | + { | ||
| 40 | 41 | ((dynamic)self).PyCallback(self); | |
| 42 | + } | ||
| 41 | 43 | } | |
| 42 | 44 | } | |
| 43 | 45 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,8 +10,8 @@ public class ClassTest | |||
| 10 | 10 | { | |
| 11 | 11 | public static ArrayList GetArrayList() | |
| 12 | 12 | { | |
| 13 | - ArrayList list = new ArrayList(); | ||
| 14 | - for (int i = 0; i < 10; i++) | ||
| 13 | + var list = new ArrayList(); | ||
| 14 | + for (var i = 0; i < 10; i++) | ||
| 15 | 15 | { | |
| 16 | 16 | list.Add(i); | |
| 17 | 17 | } | |
@@ -20,7 +20,7 @@ public static ArrayList GetArrayList() | |||
| 20 | 20 | ||
| 21 | 21 | public static Hashtable GetHashtable() | |
| 22 | 22 | { | |
| 23 | - Hashtable dict = new Hashtable(); | ||
| 23 | + var dict = new Hashtable(); | ||
| 24 | 24 | dict.Add("one", 1); | |
| 25 | 25 | dict.Add("two", 2); | |
| 26 | 26 | dict.Add("three", 3); | |
@@ -31,7 +31,7 @@ public static Hashtable GetHashtable() | |||
| 31 | 31 | ||
| 32 | 32 | public static IEnumerator GetEnumerator() | |
| 33 | 33 | { | |
| 34 | - string temp = "test string"; | ||
| 34 | + var temp = "test string"; | ||
| 35 | 35 | return temp.GetEnumerator(); | |
| 36 | 36 | } | |
| 37 | 37 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ public class EnumConstructorTest | |||
| 13 | 13 | ||
| 14 | 14 | public EnumConstructorTest(TypeCode v) | |
| 15 | 15 | { | |
| 16 | - this.value = v; | ||
| 16 | + value = v; | ||
| 17 | 17 | } | |
| 18 | 18 | } | |
| 19 | 19 | ||
@@ -24,7 +24,7 @@ public class FlagsConstructorTest | |||
| 24 | 24 | ||
| 25 | 25 | public FlagsConstructorTest(FileAccess v) | |
| 26 | 26 | { | |
| 27 | - this.value = v; | ||
| 27 | + value = v; | ||
| 28 | 28 | } | |
| 29 | 29 | } | |
| 30 | 30 | ||
@@ -35,7 +35,7 @@ public class StructConstructorTest | |||
| 35 | 35 | ||
| 36 | 36 | public StructConstructorTest(Guid v) | |
| 37 | 37 | { | |
| 38 | - this.value = v; | ||
| 38 | + value = v; | ||
| 39 | 39 | } | |
| 40 | 40 | } | |
| 41 | 41 | ||
@@ -46,7 +46,7 @@ public class SubclassConstructorTest | |||
| 46 | 46 | ||
| 47 | 47 | public SubclassConstructorTest(Exception v) | |
| 48 | 48 | { | |
| 49 | - this.value = v; | ||
| 49 | + value = v; | ||
| 50 | 50 | } | |
| 51 | 51 | } | |
| 52 | 52 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,7 +33,7 @@ public class EventTest | |||
| 33 | 33 | ||
| 34 | 34 | public EventTest() | |
| 35 | 35 | { | |
| 36 | - this.value = 0; | ||
| 36 | + value = 0; | ||
| 37 | 37 | } | |
| 38 | 38 | ||
| 39 | 39 | static EventTest() | |
@@ -80,7 +80,7 @@ protected static void OnProtectedStaticEvent(EventArgsTest e) | |||
| 80 | 80 | ||
| 81 | 81 | public void GenericHandler(object sender, EventArgsTest e) | |
| 82 | 82 | { | |
| 83 | - this.value = e.value; | ||
| 83 | + value = e.value; | ||
| 84 | 84 | } | |
| 85 | 85 | ||
| 86 | 86 | public static void StaticHandler(object sender, EventArgsTest e) | |
@@ -91,8 +91,8 @@ public static void StaticHandler(object sender, EventArgsTest e) | |||
| 91 | 91 | public static void ShutUpCompiler() | |
| 92 | 92 | { | |
| 93 | 93 | // Quiet compiler warnings. | |
| 94 | - EventTest e = new EventTest(); | ||
| 95 | - EventHandlerTest f = new EventHandlerTest(e.GenericHandler); | ||
| 94 | + var e = new EventTest(); | ||
| 95 | + EventHandlerTest f = e.GenericHandler; | ||
| 96 | 96 | ProtectedStaticEvent += f; | |
| 97 | 97 | InternalStaticEvent += f; | |
| 98 | 98 | PrivateStaticEvent += f; | |
@@ -109,7 +109,7 @@ public class EventArgsTest : EventArgs | |||
| 109 | 109 | ||
| 110 | 110 | public EventArgsTest(int v) | |
| 111 | 111 | { | |
| 112 | - this.value = v; | ||
| 112 | + value = v; | ||
| 113 | 113 | } | |
| 114 | 114 | } | |
| 115 | 115 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -78,7 +78,7 @@ public static void ThrowChainedExceptions() | |||
| 78 | 78 | ||
| 79 | 79 | public class ExtendedException : OverflowException | |
| 80 | 80 | { | |
| 81 | - public ExtendedException() : base() | ||
| 81 | + public ExtendedException() | ||
| 82 | 82 | { | |
| 83 | 83 | } | |
| 84 | 84 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,8 +21,8 @@ public class GenericTypeDefinition<T, U> | |||
| 21 | 21 | ||
| 22 | 22 | public GenericTypeDefinition(T arg1, U arg2) | |
| 23 | 23 | { | |
| 24 | - this.value1 = arg1; | ||
| 25 | - this.value2 = arg2; | ||
| 24 | + value1 = arg1; | ||
| 25 | + value2 = arg2; | ||
| 26 | 26 | } | |
| 27 | 27 | } | |
| 28 | 28 | ||
@@ -34,7 +34,7 @@ public class DerivedFromOpenGeneric<V, W> : | |||
| 34 | 34 | public DerivedFromOpenGeneric(int arg1, V arg2, W arg3) : | |
| 35 | 35 | base(arg1, arg2) | |
| 36 | 36 | { | |
| 37 | - this.value3 = arg3; | ||
| 37 | + value3 = arg3; | ||
| 38 | 38 | } | |
| 39 | 39 | } | |
| 40 | 40 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,5 @@ | |||
| 1 | 1 | using System; | |
| 2 | + using System.Reflection; | ||
| 2 | 3 | using System.Threading; | |
| 3 | 4 | ||
| 4 | 5 | namespace Python.Test | |
@@ -11,9 +12,9 @@ public static void RunThreads() | |||
| 11 | 12 | { | |
| 12 | 13 | _thread = new Thread(() => | |
| 13 | 14 | { | |
| 14 | - var appdomain = AppDomain.CurrentDomain; | ||
| 15 | - var assemblies = appdomain.GetAssemblies(); | ||
| 16 | - foreach (var assembly in assemblies) | ||
| 15 | + AppDomain appdomain = AppDomain.CurrentDomain; | ||
| 16 | + Assembly[] assemblies = appdomain.GetAssemblies(); | ||
| 17 | + foreach (Assembly assembly in assemblies) | ||
| 17 | 18 | { | |
| 18 | 19 | assembly.GetTypes(); | |
| 19 | 20 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments