- Notifications
You must be signed in to change notification settings - Fork752
Some fixes.#219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Some fixes.#219
Changes from1 commit
Commits
Show all changes
6 commits Select commitHold shift + click to select a range
cd14a4a
fix NullReferenceException when using null on a argument list.
matthid87e1df3
Fix NotSupportedException when using the project in an F# interactive…
matthid8effe30
add test for #182
matthid65626c3
add test for using null like 'None' for default arguments. See 35cd5fa
matthid4b08abd
Workaround mono bug, see https://bugzilla.xamarin.com/show_bug.cgi?id…
matthidc07e9fe
whitespace to trigger appveyor
matthidFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
add test for using null like 'None' for default arguments. See35cd5fa
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commit65626c3c5f8e82e7b51cccf92a86d51eb0dab444
There are no files selected for viewing
2 changes: 2 additions & 0 deletionssrc/testing/Python.Test.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletionssrc/testing/callbacktest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
namespace Python.Test | ||
{ | ||
//======================================================================== | ||
// Tests callbacks into python code. | ||
//======================================================================== | ||
public class CallbackTest | ||
{ | ||
public string Call_simpleDefaultArg_WithNull(string moduleName) | ||
{ | ||
using (Runtime.Py.GIL()) | ||
{ | ||
dynamic module = Runtime.Py.Import(moduleName); | ||
return module.simpleDefaultArg(null); | ||
} | ||
} | ||
public string Call_simpleDefaultArg_WithEmptyArgs(string moduleName) | ||
{ | ||
using (Runtime.Py.GIL()) | ||
{ | ||
dynamic module = Runtime.Py.Import(moduleName); | ||
return module.simpleDefaultArg(); | ||
} | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletionssrc/tests/test_suite/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletionssrc/tests/test_suite/test_callback.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import unittest, sys | ||
import clr | ||
this_module = sys.modules[__name__] | ||
clr.AddReference("Python.Test") | ||
import Python.Test as Test | ||
from Python.Test import CallbackTest | ||
test_instance = CallbackTest() | ||
def simpleDefaultArg(arg = 'test'): | ||
return arg | ||
class CallbackTests(unittest.TestCase): | ||
"""Test that callbacks from C# into python work.""" | ||
def testDefaultForNull(self): | ||
"""Test that C# can use null for an optional python argument""" | ||
retVal = test_instance.Call_simpleDefaultArg_WithNull(__name__) | ||
pythonRetVal = simpleDefaultArg(None) | ||
self.assertEquals(retVal, pythonRetVal) | ||
def testDefaultForNone(self): | ||
"""Test that C# can use no argument for an optional python argument""" | ||
retVal = test_instance.Call_simpleDefaultArg_WithEmptyArgs(__name__) | ||
pythonRetVal = simpleDefaultArg() | ||
self.assertEquals(retVal, pythonRetVal) | ||
def test_suite(): | ||
return unittest.makeSuite(CallbackTests) | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.