コード例 #1
0
ファイル: test_class.py プロジェクト: mayank1897/pybind11
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
コード例 #2
0
ファイル: test_class.py プロジェクト: mayank1897/pybind11
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
コード例 #3
0
ファイル: test_class.py プロジェクト: mayank1897/pybind11
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
コード例 #4
0
ファイル: test_class.py プロジェクト: mayank1897/pybind11
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