def testClassStaysInScope(self):
        filt = {'key': 'unittest', 'This matches': 555}

        payload = Payload()
        payload.filt = filt

        inst = PayloadEndpointPyTestAssignPayload(self)
        PayloadEndpoint(filt, inst.process)

        PayloadIO().process(payloadEnvelope=payload.makePayloadEnvelope(),
                            vortexUuid='test',
                            vortexName='test',
                            httpSession=None,
                            sendResponse=lambda x: x)

        self.assertEqual(
            self.deliveredPayloadEnvelope, payload,
            'PayloadIO/PayloadEndpoint unmatched value test error')
    def testFunctionGoesOutOfScope(self):
        filt = {'key': 'unittest', 'This matches': 555}

        payload = Payload()
        payload.filt = filt

        def subScope():
            def outOfScopeFunc(payloadEnvelope: PayloadEnvelope, *args,
                               **kwargs):
                self.deliveredPayloadEnvelope = payloadEnvelope

            PayloadEndpoint(filt, outOfScopeFunc)

        PayloadIO().process(payloadEnvelope=payload.makePayloadEnvelope(),
                            vortexUuid='test',
                            vortexName='test',
                            httpSession=None,
                            sendResponse=lambda x: x)

        self.assertEqual(
            self.deliveredPayloadEnvelope, None,
            'PayloadIO/PayloadEndpoint unmatched value test error')