Esempio n. 1
0
def createObjects(withCycles=True) -> Any:
    stock = Stock()
    stock.id = Integer(123)
    stock.name = "YASS"
    stock.paysDividend = True

    unknownInstrumentsException = UnknownInstrumentsException()
    unknownInstrumentsException.instrumentIds = [Integer(1), Integer(2), Integer(3)]

    node1 = Node()
    node1.id = 1.0
    node2 = Node()
    node2.id = 2.0
    node2.links = []
    node1.links = [node1, node2]

    result = [
        None,
        False,
        True,
        Integer(123456),
        Integer(-987654),
        1.34545e98,
        "Hello",
        ">\u0001\u0012\u007F\u0080\u0234\u07FF\u0800\u4321\uFFFF<",
        bytes([0, 127, 256 - 1, 10, 256 - 45]),
        Expiration(2017, 11, 29),
        PriceKind.ASK,
        PriceKind.BID,
        stock,
        unknownInstrumentsException
    ]
    return cast(List[Node], result) + [node1] if withCycles else result
Esempio n. 2
0
def createObjects(withCycles=True) -> Any:
    stock = Stock()
    stock.id = Integer(123)
    stock.name = "YASS"
    stock.paysDividend = True

    unknownInstrumentsException = UnknownInstrumentsException()
    unknownInstrumentsException.instrumentIds = [Integer(1), Integer(2), Integer(3)]

    node1 = Node()
    node1.id = 1.0
    node2 = Node()
    node2.id = 2.0
    node2.links = []
    node1.links = [node1, node2]

    result = [
        None,
        False,
        True,
        Integer(123456),
        Integer(-987654),
        1.34545e98,
        "Hello",
        ">\u0001\u0012\u007F\u0080\u0234\u07FF\u0800\u4321\uFFFF<",
        bytes([0, 127, 256 - 1, 10, 256 - 45]),
        Expiration(2017, 11, 29),
        PriceKind.ASK,
        PriceKind.BID,
        stock,
        unknownInstrumentsException
    ]
    return cast(List[Node], result) + [node1] if withCycles else result
Esempio n. 3
0
 def testClasses(self):
     bond = Bond()
     bond.name = u"ABB"
     bond.coupon = 1.5
     stock = Stock()
     stock.name = u"ABB"
     stock.paysDividend = True
     node1 = Node()
     self.assertEqual(yass.typeDesc(node1).id, 15)
     node1.id = 1.
     node2 = Node()
     node2.id = 2.
     node2.links = [node1, node2]
     try:
         uie = UnknownInstrumentsException()
         uie.instrumentIds = [Integer(333), Integer(444)]
         uie.onlyNeededForTests2 = b'abc'
         raise uie
     except UnknownInstrumentsException as e:
         pass
Esempio n. 4
0
 def testClasses(self):
     bond = Bond()
     bond.name = "ABB"
     bond.coupon = 1.5
     stock = Stock()
     stock.name = "ABB"
     stock.paysDividend = True
     node1 = Node()
     self.assertEqual(yass.typeDesc(node1).id, 15)
     node1.id = 1.
     node2 = Node()
     node2.id = 2.
     node2.links = [node1, node2]
     try:
         uie = UnknownInstrumentsException()
         uie.instrumentIds = [Integer(333), Integer(444)]
         uie.onlyNeededForTests2 = b'abc'
         raise uie
     except UnknownInstrumentsException as e:
         pass