示例#1
0
def test_pure_interfaces_can_be_used_transparently_when_added_to_jsii_type():
    expected = StructB(required_string="It's Britney b**ch!")

    @jsii.implements(IStructReturningDelegate)
    class ImplementsAdditionalInterface(AllTypes):
        def return_struct(self):
            return expected

    delegate = ImplementsAdditionalInterface()
    consumer = ConsumePureInterface(delegate)
    assert consumer.work_it_baby() == expected
示例#2
0
def test_pure_interfaces_can_be_used_transparently():
    expected = StructB(required_string="It's Britney b**ch!")

    @jsii.implements(IStructReturningDelegate)
    class StructReturningDelegate:
        def return_struct(self):
            return expected

    delegate = StructReturningDelegate()
    consumer = ConsumePureInterface(delegate)
    assert consumer.work_it_baby() == expected