當前位置: 首頁>>代碼示例>>Python>>正文


Python Test.DelegateTest類代碼示例

本文整理匯總了Python中Python.Test.DelegateTest的典型用法代碼示例。如果您正苦於以下問題:Python DelegateTest類的具體用法?Python DelegateTest怎麽用?Python DelegateTest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DelegateTest類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_delegate_equality

    def test_delegate_equality(self):
        """Test delegate equality."""

        d = StringDelegate(hello_func)
        ob = DelegateTest()
        ob.stringDelegate = d
        self.assertTrue(ob.stringDelegate == d)
開發者ID:brudo,項目名稱:pythonnet-1,代碼行數:7,代碼來源:test_delegate.py

示例2: test_delegate_equality

def test_delegate_equality():
    """Test delegate equality."""

    d = StringDelegate(hello_func)
    ob = DelegateTest()
    ob.stringDelegate = d
    assert ob.stringDelegate == d
開發者ID:AlexCatarino,項目名稱:pythonnet,代碼行數:7,代碼來源:test_delegate.py

示例3: testDelegateEquality

    def testDelegateEquality(self):
        """Test delegate equality."""

        def sayhello():
            return "hello"

        d = StringDelegate(sayhello)
        ob = DelegateTest()
        ob.stringDelegate = d
        self.failUnless(ob.stringDelegate == d)
開發者ID:ForrestFeng,項目名稱:pythonnet,代碼行數:10,代碼來源:test_delegate.py

示例4: testDelegateFromManagedInstanceMethod

    def testDelegateFromManagedInstanceMethod(self):
        """Test delegate implemented with a managed instance method."""
        ob = DelegateTest()
        d = StringDelegate(ob.SayHello)

        self.failUnless(ob.CallStringDelegate(d) == "hello")
        self.failUnless(d() == "hello")

        ob.stringDelegate = d
        self.failUnless(ob.CallStringDelegate(ob.stringDelegate) == "hello")
        self.failUnless(ob.stringDelegate() == "hello")
開發者ID:ForrestFeng,項目名稱:pythonnet,代碼行數:11,代碼來源:test_delegate.py

示例5: testDelegateFromManagedStaticMethod

    def testDelegateFromManagedStaticMethod(self):
        """Test delegate implemented with a managed static method."""
        d = StringDelegate(DelegateTest.StaticSayHello)
        ob = DelegateTest()

        self.failUnless(ob.CallStringDelegate(d) == "hello")
        self.failUnless(d() == "hello")

        ob.stringDelegate = d
        self.failUnless(ob.CallStringDelegate(ob.stringDelegate) == "hello")
        self.failUnless(ob.stringDelegate() == "hello")
開發者ID:ForrestFeng,項目名稱:pythonnet,代碼行數:11,代碼來源:test_delegate.py

示例6: test_delegate_from_managed_instance_method

    def test_delegate_from_managed_instance_method(self):
        """Test delegate implemented with a managed instance method."""
        ob = DelegateTest()
        d = StringDelegate(ob.SayHello)

        self.assertTrue(ob.CallStringDelegate(d) == "hello")
        self.assertTrue(d() == "hello")

        ob.stringDelegate = d
        self.assertTrue(ob.CallStringDelegate(ob.stringDelegate) == "hello")
        self.assertTrue(ob.stringDelegate() == "hello")
開發者ID:brudo,項目名稱:pythonnet-1,代碼行數:11,代碼來源:test_delegate.py

示例7: test_delegate_from_managed_static_method

def test_delegate_from_managed_static_method():
    """Test delegate implemented with a managed static method."""
    d = StringDelegate(DelegateTest.StaticSayHello)
    ob = DelegateTest()

    assert ob.CallStringDelegate(d) == "hello"
    assert d() == "hello"

    ob.stringDelegate = d
    assert ob.CallStringDelegate(ob.stringDelegate) == "hello"
    assert ob.stringDelegate() == "hello"
開發者ID:AlexCatarino,項目名稱:pythonnet,代碼行數:11,代碼來源:test_delegate.py

示例8: test_delegate_from_managed_instance_method

def test_delegate_from_managed_instance_method():
    """Test delegate implemented with a managed instance method."""
    ob = DelegateTest()
    d = StringDelegate(ob.SayHello)

    assert ob.CallStringDelegate(d) == "hello"
    assert d() == "hello"

    ob.stringDelegate = d
    assert ob.CallStringDelegate(ob.stringDelegate) == "hello"
    assert ob.stringDelegate() == "hello"
開發者ID:AlexCatarino,項目名稱:pythonnet,代碼行數:11,代碼來源:test_delegate.py

示例9: test_delegate_from_delegate

def test_delegate_from_delegate():
    """Test delegate implemented with another delegate."""
    d1 = StringDelegate(hello_func)
    d2 = StringDelegate(d1)
    ob = DelegateTest()

    assert ob.CallStringDelegate(d2) == "hello"
    assert d2() == "hello"

    ob.stringDelegate = d2
    assert ob.CallStringDelegate(ob.stringDelegate) == "hello"
    assert ob.stringDelegate() == "hello"
開發者ID:AlexCatarino,項目名稱:pythonnet,代碼行數:12,代碼來源:test_delegate.py

示例10: test_delegate_from_function

def test_delegate_from_function():
    """Test delegate implemented with a Python function."""

    d = StringDelegate(hello_func)
    ob = DelegateTest()

    assert ob.CallStringDelegate(d) == "hello"
    assert d() == "hello"

    ob.stringDelegate = d
    assert ob.CallStringDelegate(ob.stringDelegate) == "hello"
    assert ob.stringDelegate() == "hello"
開發者ID:AlexCatarino,項目名稱:pythonnet,代碼行數:12,代碼來源:test_delegate.py

示例11: test_delegate_from_function

    def test_delegate_from_function(self):
        """Test delegate implemented with a Python function."""

        d = StringDelegate(hello_func)
        ob = DelegateTest()

        self.assertTrue(ob.CallStringDelegate(d) == "hello")
        self.assertTrue(d() == "hello")

        ob.stringDelegate = d
        self.assertTrue(ob.CallStringDelegate(ob.stringDelegate) == "hello")
        self.assertTrue(ob.stringDelegate() == "hello")
開發者ID:brudo,項目名稱:pythonnet-1,代碼行數:12,代碼來源:test_delegate.py

示例12: test_delegate_from_delegate

    def test_delegate_from_delegate(self):
        """Test delegate implemented with another delegate."""
        d1 = StringDelegate(hello_func)
        d2 = StringDelegate(d1)
        ob = DelegateTest()

        self.assertTrue(ob.CallStringDelegate(d2) == "hello")
        self.assertTrue(d2() == "hello")

        ob.stringDelegate = d2
        self.assertTrue(ob.CallStringDelegate(ob.stringDelegate) == "hello")
        self.assertTrue(ob.stringDelegate() == "hello")
開發者ID:brudo,項目名稱:pythonnet-1,代碼行數:12,代碼來源:test_delegate.py

示例13: test_delegate_from_method

def test_delegate_from_method():
    """Test delegate implemented with a Python instance method."""

    inst = HelloClass()
    d = StringDelegate(inst.hello)
    ob = DelegateTest()

    assert ob.CallStringDelegate(d) == "hello"
    assert d() == "hello"

    ob.stringDelegate = d
    assert ob.CallStringDelegate(ob.stringDelegate) == "hello"
    assert ob.stringDelegate() == "hello"
開發者ID:AlexCatarino,項目名稱:pythonnet,代碼行數:13,代碼來源:test_delegate.py

示例14: test_delegate_from_callable

def test_delegate_from_callable():
    """Test delegate implemented with a Python callable object."""

    inst = HelloClass()
    d = StringDelegate(inst)
    ob = DelegateTest()

    assert ob.CallStringDelegate(d) == "hello"
    assert d() == "hello"

    ob.stringDelegate = d
    assert ob.CallStringDelegate(ob.stringDelegate) == "hello"
    assert ob.stringDelegate() == "hello"
開發者ID:AlexCatarino,項目名稱:pythonnet,代碼行數:13,代碼來源:test_delegate.py

示例15: testDelegateFromFunction

    def testDelegateFromFunction(self):
        """Test delegate implemented with a Python function."""

        def sayhello():
            return "hello"

        d = StringDelegate(sayhello)
        ob = DelegateTest()

        self.failUnless(ob.CallStringDelegate(d) == "hello")
        self.failUnless(d() == "hello")

        ob.stringDelegate = d
        self.failUnless(ob.CallStringDelegate(ob.stringDelegate) == "hello")
        self.failUnless(ob.stringDelegate() == "hello")
開發者ID:ForrestFeng,項目名稱:pythonnet,代碼行數:15,代碼來源:test_delegate.py


注:本文中的Python.Test.DelegateTest類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。