forked from pythonnet/pythonnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_callback.py
More file actions
30 lines (23 loc) · 964 Bytes
/
test_callback.py
File metadata and controls
30 lines (23 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)