|
1 |
| -import pythonnative |
2 |
| -from pythonnative.foo import pyFoo |
3 |
| -from pythonnative.bar import pyBar |
4 |
| -from pythonnative.foobar import pyFooBar |
| 1 | +import cmakepybind11 |
| 2 | +from cmakepybind11.foo import pyFoo |
| 3 | +from cmakepybind11.bar import pyBar |
| 4 | +from cmakepybind11.foobar import pyFooBar |
5 | 5 |
|
6 |
| -print(f'version: {pythonnative.__version__}') |
| 6 | +print(f'version: {cmakepybind11.__version__}') |
7 | 7 |
|
8 | 8 | # foo
|
9 | 9 | print(f'Foo: {dir(pyFoo.Foo)}')
|
10 | 10 |
|
11 |
| -p = pyFoo.IntPair(3, 5) |
12 |
| -print(f"class IntPair: {dir(p)}") |
13 |
| -print(f"p: {p}") |
14 | 11 | pyFoo.free_function(2147483647) # max int
|
15 | 12 | pyFoo.free_function(2147483647+1) # max int + 1
|
16 | 13 |
|
|
19 | 16 | f.static_function(1)
|
20 | 17 | f.static_function(2147483647)
|
21 | 18 | f.static_function(2147483647+1)
|
22 |
| -f.set_int(13) |
23 |
| -assert(f.get_int() == 13) |
24 |
| -f.set_int64(31) |
25 |
| -assert(f.get_int64() == 31) |
| 19 | +f.int = 13 |
| 20 | +assert(f.int == 13) |
| 21 | +f.int64 = 31 |
| 22 | +assert(f.int64 == 31) |
26 | 23 |
|
27 | 24 | # bar
|
28 | 25 | print(f'Bar: {dir(pyBar.Bar)}')
|
29 | 26 |
|
30 |
| -p = pyBar.IntPair(3, 5) |
31 |
| -print(f"class IntPair: {dir(p)}") |
32 |
| -print(f"p: {p}") |
33 | 27 | pyBar.free_function(2147483647) # max int
|
34 | 28 | pyBar.free_function(2147483647+1) # max int + 1
|
35 | 29 |
|
|
38 | 32 | b.static_function(1)
|
39 | 33 | b.static_function(2147483647)
|
40 | 34 | b.static_function(2147483647+1)
|
41 |
| -b.set_int(13) |
42 |
| -assert(b.get_int() == 13) |
43 |
| -b.set_int64(31) |
44 |
| -assert(b.get_int64() == 31) |
| 35 | +b.int = 13 |
| 36 | +assert(b.int == 13) |
| 37 | +b.int64 = 31 |
| 38 | +assert(b.int64 == 31) |
45 | 39 |
|
46 | 40 | # foobar
|
47 | 41 | print(f'FooBar: {dir(pyFooBar.FooBar)}')
|
48 | 42 |
|
49 |
| -p = pyFooBar.IntPair(3, 5) |
50 |
| -print(f"class IntPair: {dir(p)}") |
51 |
| -print(f"p: {p}") |
52 | 43 | pyFooBar.free_function(2147483647) # max int
|
53 | 44 | pyFooBar.free_function(2147483647+1) # max int + 1
|
54 | 45 |
|
|
57 | 48 | fb.static_function(1)
|
58 | 49 | fb.static_function(2147483647)
|
59 | 50 | fb.static_function(2147483647+1)
|
60 |
| -fb.set_foo_int(13) |
61 |
| -fb.set_bar_int(17) |
62 |
| -assert(fb.get_int() == 30) |
63 |
| -fb.set_foo_int64(31) |
64 |
| -fb.set_bar_int64(37) |
65 |
| -assert(fb.get_int64() == 68) |
| 51 | +fb.foo_int = 13 |
| 52 | +fb.bar_int = 17 |
| 53 | +assert(fb.int == 30) |
| 54 | +fb.foo_int64 = 31 |
| 55 | +fb.bar_int64 = 37 |
| 56 | +assert(fb.int64 == 68) |
0 commit comments