test_constants_and_functions.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 import pytest
3 
4 m = pytest.importorskip("pybind11_tests.constants_and_functions")
5 
6 
8  assert m.some_constant == 14
9 
10 
12  assert m.test_function() == "test_function()"
13  assert m.test_function(7) == "test_function(7)"
14  assert m.test_function(m.MyEnum.EFirstEntry) == "test_function(enum=1)"
15  assert m.test_function(m.MyEnum.ESecondEntry) == "test_function(enum=2)"
16 
17  assert m.test_function() == "test_function()"
18  assert m.test_function("abcd") == "test_function(char *)"
19  assert m.test_function(1, 1.0) == "test_function(int, float)"
20  assert m.test_function(1, 1.0) == "test_function(int, float)"
21  assert m.test_function(2.0, 2) == "test_function(float, int)"
22 
23 
24 def test_bytes():
25  assert m.print_bytes(m.return_bytes()) == "bytes[1 0 2 0]"
26 
27 
29  c = m.C()
30  assert c.m1(2) == 1
31  assert c.m2(3) == 1
32  assert c.m3(5) == 2
33  assert c.m4(7) == 3
34  assert c.m5(10) == 5
35  assert c.m6(14) == 8
36  assert c.m7(20) == 13
37  assert c.m8(29) == 21
38 
39  assert m.f1(33) == 34
40  assert m.f2(53) == 55
41  assert m.f3(86) == 89
42  assert m.f4(140) == 144


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:46:03