Ejemplo n.º 1
0
def test_as_type_py():
    assert m.as_type(int) == int

    with pytest.raises(RuntimeError):
        assert m.as_type(1) == int

    with pytest.raises(RuntimeError):
        assert m.as_type(m.DerivedClass1()) == m.DerivedClass1
Ejemplo n.º 2
0
def test_type_of_classic():
    assert m.get_type_classic(1) == int
    assert m.get_type_classic(m.DerivedClass1()) == m.DerivedClass1
    assert m.get_type_classic(int) == type
Ejemplo n.º 3
0
def test_type_of_py_nodelete():
    # If the above test deleted the class, this will segfault
    assert m.get_type_of(m.DerivedClass1()) == m.DerivedClass1
Ejemplo n.º 4
0
def test_type_of_py():
    assert m.get_type_of(1) == int
    assert m.get_type_of(m.DerivedClass1()) == m.DerivedClass1
    assert m.get_type_of(int) == type