Пример #1
0
    def test_call_wait(self):
        """ Test a procedure call and wait """
        call = self.client.call(scscp.get_allowed_heads())
        self.assertEqual(call.type, "procedure_call")
        self.assertEqual(call.params, [(om.OMSymbol('option_return_object', 'scscp1'), om.OMString(True))])
        self.assertEqual(call.data, om.OMApplication(om.OMSymbol('get_allowed_heads', 'scscp2'), []))

        msg = decode_bytes(self.server.receive())
        self.assertEqual(msg, om.OMObject(om.OMAttribution(
            om.OMAttributionPairs([
                (om.OMSymbol('call_id', 'scscp1'), om.OMString(call.id)),
                (om.OMSymbol('option_return_object', 'scscp1'), om.OMString('True'))
            ]),
            om.OMApplication(om.OMSymbol('procedure_call', 'scscp1'), [
                om.OMApplication(om.OMSymbol('get_allowed_heads', 'scscp2'), [])])
        ), version='2.0'))

        comp = scscp.SCSCPProcedureMessage.completed(call.id, scscp.symbol_set())
        self.server.send(encode_bytes(comp.om()))

        resp = self.client.wait()
        self.assertEqual(resp.type, "procedure_completed")
        self.assertEqual(resp.id, call.id)
        self.assertEqual(resp.params, [])
        self.assertEqual(resp.data, om.OMApplication(
            om.OMSymbol('symbol_set', 'scscp2'),
            [om.OMApplication(om.OMSymbol('CDName', 'meta'), [om.OMString('scscp1')]),
                 om.OMApplication(om.OMSymbol('CDName', 'meta'), [om.OMString('scscp2')])
            ]
        ))
Пример #2
0
    def test_call_wait(self):
        """ Test a procedure call and wait """
        call = self.client.call(scscp.get_allowed_heads())
        self.assertEqual(call.type, "procedure_call")
        self.assertEqual(call.params, [(om.OMSymbol('option_return_object', 'scscp1'), om.OMString(True))])
        self.assertEqual(call.data, om.OMApplication(om.OMSymbol('get_allowed_heads', 'scscp2'), []))

        msg = decode_bytes(self.server.receive())
        self.assertEqual(msg, om.OMObject(om.OMAttribution(
            om.OMAttributionPairs([
                (om.OMSymbol('call_id', 'scscp1'), om.OMString(call.id)),
                (om.OMSymbol('option_return_object', 'scscp1'), om.OMString('True'))
            ]),
            om.OMApplication(om.OMSymbol('procedure_call', 'scscp1'), [
                om.OMApplication(om.OMSymbol('get_allowed_heads', 'scscp2'), [])])
        ), version='2.0'))

        comp = scscp.SCSCPProcedureMessage.completed(call.id, scscp.symbol_set())
        self.server.send(encode_bytes(comp.om()))

        resp = self.client.wait()
        self.assertEqual(resp.type, "procedure_completed")
        self.assertEqual(resp.id, call.id)
        self.assertEqual(resp.params, [])
        self.assertEqual(resp.data, om.OMApplication(
            om.OMSymbol('symbol_set', 'scscp2'),
            [om.OMApplication(om.OMSymbol('CDName', 'meta'), [om.OMString('scscp1')]),
                 om.OMApplication(om.OMSymbol('CDName', 'meta'), [om.OMString('scscp2')])
            ]
        ))
Пример #3
0
 def get_allowed_heads(self, data):
     return scscp.symbol_set([om.OMSymbol(head, cd='scscp2') for head in CD_SCSCP2]
                                 + [om.OMSymbol(head, cd='arith1') for head in CD_ARITH1],
                                 cdnames=['scscp1'])
Пример #4
0
 def get_allowed_heads(self, data):
     return scscp.symbol_set(
         [om.OMSymbol(head, cd='scscp2') for head in CD_SCSCP2] +
         [om.OMSymbol(head, cd='singular') for head in CD_SINGULAR],
         cdnames=['scscp1'])
Пример #5
0
 def get_allowed_heads(self, data):
     return scscp.symbol_set(
         [om.OMSymbol(base=MitMEval, cd=MitMCD, name=MitMEval)],
         cdnames=[MitMCD, 'scscp1'])
Пример #6
0
 def get_allowed_heads(self, data):
     return scscp.symbol_set([om.OMSymbol(head, cd='scscp2') for head in CD_SCSCP2]
                                 + [om.OMSymbol(head, cd='arith1') for head in CD_ARITH1],
                                 cdnames=['scscp1'])