Exemple #1
0
def test_PrimitiveIntObject_as_primitive_string():
    o = PrimitiveIntObject(2)

    plus_slot = o.slot_lookup("asString")
    assert plus_slot.map.primitive_code
    result = plus_slot.map.primitive_code(None, o, [])
    assert result == PrimitiveStrObject("2")
Exemple #2
0
def call_primitive_int_binary_op(first, op, second, equals):
    o = PrimitiveIntObject(first)

    if isinstance(equals, (int, long)):
        equals = PrimitiveIntObject(equals)

    primitive_slot = o.slot_lookup(op)
    assert primitive_slot.map.primitive_code
    result = primitive_slot.map.primitive_code(None, o,
                                               [PrimitiveIntObject(second)])
    assert result == equals