Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ addons:
- nunit-console

install:
- pip install pycparser coverage codecov six
- pip install pycparser coverage codecov
- coverage run setup.py build_ext --inplace

script:
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ init:

install:
# install for wheels & coverage
- pip install --upgrade pip wheel coverage codecov six
- pip install --upgrade pip wheel coverage codecov

# Install OpenCover. Can't put on packages.config; not Linux/Mono compatible
- .\tools\nuget\nuget.exe install OpenCover -OutputDirectory packages
Expand Down
5 changes: 1 addition & 4 deletions src/testing/arraytest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections;

namespace Python.Test
{
//========================================================================
Expand Down Expand Up @@ -318,4 +315,4 @@ public static Spam[][] EchoRangeAA(Spam[][] items)
return items;
}
}
}
}
20 changes: 9 additions & 11 deletions src/testing/callbacktest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Python.Runtime;

namespace Python.Test
{
Expand All @@ -13,32 +10,33 @@ public class CallbackTest
{
public string Call_simpleDefaultArg_WithNull(string moduleName)
{
using (Runtime.Py.GIL())
using (Py.GIL())
{
dynamic module = Runtime.Py.Import(moduleName);
dynamic module = Py.Import(moduleName);
return module.simpleDefaultArg(null);
}
}

public string Call_simpleDefaultArg_WithEmptyArgs(string moduleName)
{
using (Runtime.Py.GIL())
using (Py.GIL())
{
dynamic module = Runtime.Py.Import(moduleName);
dynamic module = Py.Import(moduleName);
return module.simpleDefaultArg();
}
}
}

//==========================================================================
// Tests calling from Python into C# and back into Python using a PyObject.
// SelfCallbackTest should be inherited by a Python class.
// SelfCallbackTest should be inherited by a Python class.
// Used in test_class.py / testCallback
//==========================================================================
public class SelfCallbackTest
{
public void Callback(Runtime.PyObject self)
public void Callback(PyObject self)
{
using (Runtime.Py.GIL())
using (Py.GIL())
((dynamic)self).PyCallback(self);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/testing/classtest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Collections;

namespace Python.Test
Expand Down Expand Up @@ -61,4 +60,4 @@ public ClassCtorTest2(string v)
internal class InternalClass
{
}
}
}
3 changes: 1 addition & 2 deletions src/testing/constructortests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.IO;

namespace Python.Test
Expand Down Expand Up @@ -50,4 +49,4 @@ public SubclassConstructorTest(Exception v)
this.value = v;
}
}
}
}
5 changes: 1 addition & 4 deletions src/testing/conversiontest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;


namespace Python.Test
{
//========================================================================
Expand Down Expand Up @@ -58,4 +55,4 @@ public string GetValue()
return value;
}
}
}
}
4 changes: 1 addition & 3 deletions src/testing/delegatetest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace Python.Test
{
//========================================================================
Expand Down Expand Up @@ -60,4 +58,4 @@ public bool CallBoolDelegate(BoolDelegate d)
return d();
}
}
}
}
14 changes: 7 additions & 7 deletions src/testing/doctest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ namespace Python.Test

// Classes with a constructor have their docstring set to the ctor signature.
// Test if a class has an explicit doc string it gets set correctly.
[DocStringAttribute("DocWithCtorTest Class")]
[DocString("DocWithCtorTest Class")]
public class DocWithCtorTest
{
public DocWithCtorTest()
{
}

[DocStringAttribute("DocWithCtorTest TestMethod")]
[DocString("DocWithCtorTest TestMethod")]
public void TestMethod()
{
}

[DocStringAttribute("DocWithCtorTest StaticTestMethod")]
[DocString("DocWithCtorTest StaticTestMethod")]
public static void StaticTestMethod()
{
}
Expand All @@ -41,17 +41,17 @@ public static void StaticTestMethod(double a, int b)
}
}

[DocStringAttribute("DocWithoutCtorTest Class")]
[DocString("DocWithoutCtorTest Class")]
public class DocWithoutCtorTest
{
[DocStringAttribute("DocWithoutCtorTest TestMethod")]
[DocString("DocWithoutCtorTest TestMethod")]
public void TestMethod()
{
}

[DocStringAttribute("DocWithoutCtorTest StaticTestMethod")]
[DocString("DocWithoutCtorTest StaticTestMethod")]
public static void StaticTestMethod()
{
}
}
}
}
4 changes: 2 additions & 2 deletions src/testing/enumtest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public enum ULongEnum : ulong
Five
}

[FlagsAttribute]
[Flags]
public enum FlagsEnum
{
Zero,
Expand All @@ -96,4 +96,4 @@ public enum FlagsEnum
Four,
Five
}
}
}
38 changes: 19 additions & 19 deletions src/testing/eventtest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ namespace Python.Test
// Supports CLR event unit tests.
//========================================================================

public delegate void TestEventHandler(object sender, TestEventArgs e);
public delegate void EventHandlerTest(object sender, EventArgsTest e);


public class EventTest
{
public static event TestEventHandler PublicStaticEvent;
public static event EventHandlerTest PublicStaticEvent;

protected static event TestEventHandler ProtectedStaticEvent;
protected static event EventHandlerTest ProtectedStaticEvent;

internal static event TestEventHandler InternalStaticEvent;
internal static event EventHandlerTest InternalStaticEvent;

private static event TestEventHandler PrivateStaticEvent;
private static event EventHandlerTest PrivateStaticEvent;

public event TestEventHandler PublicEvent;
public event EventHandlerTest PublicEvent;

protected event TestEventHandler ProtectedEvent;
protected event EventHandlerTest ProtectedEvent;

internal event TestEventHandler InternalEvent;
internal event EventHandlerTest InternalEvent;

private event TestEventHandler PrivateEvent;
private event EventHandlerTest PrivateEvent;


public static int s_value;
Expand All @@ -42,7 +42,7 @@ static EventTest()
}


public void OnPublicEvent(TestEventArgs e)
public void OnPublicEvent(EventArgsTest e)
{
if (PublicEvent != null)
{
Expand All @@ -51,7 +51,7 @@ public void OnPublicEvent(TestEventArgs e)
}


public void OnProtectedEvent(TestEventArgs e)
public void OnProtectedEvent(EventArgsTest e)
{
if (ProtectedEvent != null)
{
Expand All @@ -60,7 +60,7 @@ public void OnProtectedEvent(TestEventArgs e)
}


public static void OnPublicStaticEvent(TestEventArgs e)
public static void OnPublicStaticEvent(EventArgsTest e)
{
if (PublicStaticEvent != null)
{
Expand All @@ -69,7 +69,7 @@ public static void OnPublicStaticEvent(TestEventArgs e)
}


protected static void OnProtectedStaticEvent(TestEventArgs e)
protected static void OnProtectedStaticEvent(EventArgsTest e)
{
if (ProtectedStaticEvent != null)
{
Expand All @@ -78,12 +78,12 @@ protected static void OnProtectedStaticEvent(TestEventArgs e)
}


public void GenericHandler(object sender, TestEventArgs e)
public void GenericHandler(object sender, EventArgsTest e)
{
this.value = e.value;
}

public static void StaticHandler(object sender, TestEventArgs e)
public static void StaticHandler(object sender, EventArgsTest e)
{
s_value = e.value;
}
Expand All @@ -92,7 +92,7 @@ public static void ShutUpCompiler()
{
// Quiet compiler warnings.
EventTest e = new EventTest();
TestEventHandler f = new TestEventHandler(e.GenericHandler);
EventHandlerTest f = new EventHandlerTest(e.GenericHandler);
ProtectedStaticEvent += f;
InternalStaticEvent += f;
PrivateStaticEvent += f;
Expand All @@ -103,13 +103,13 @@ public static void ShutUpCompiler()
}


public class TestEventArgs : EventArgs
public class EventArgsTest : EventArgs
{
public int value;

public TestEventArgs(int v)
public EventArgsTest(int v)
{
this.value = v;
}
}
}
}
2 changes: 1 addition & 1 deletion src/testing/exceptiontest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ public string GetExtraInfo()
return extra;
}
}
}
}
5 changes: 1 addition & 4 deletions src/testing/fieldtest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;


namespace Python.Test
{
//========================================================================
Expand Down Expand Up @@ -54,4 +51,4 @@ public void Shutup()
public object ObjectField;
public ISpam SpamField;
}
}
}
5 changes: 1 addition & 4 deletions src/testing/generictest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections;

namespace Python.Test
{
//========================================================================
Expand Down Expand Up @@ -131,4 +128,4 @@ public static string Overloaded<Q>(int arg1, int arg2, string arg3)
return arg3;
}
}
}
}
4 changes: 1 addition & 3 deletions src/testing/globaltest.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;

//========================================================================
// Supports units tests for access to types without a namespace.
//========================================================================

public class NoNamespaceType
{
}
}
3 changes: 1 addition & 2 deletions src/testing/indexertest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Collections;

namespace Python.Test
Expand Down Expand Up @@ -415,4 +414,4 @@ public MultiDefaultKeyIndexerTest() : base()
}
}
}
}
}
4 changes: 1 addition & 3 deletions src/testing/interfacetest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace Python.Test
{
//========================================================================
Expand Down Expand Up @@ -62,4 +60,4 @@ private interface IPrivate
{
}
}
}
}
Loading