forked from pybind/python_example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
42 lines (31 loc) · 1.46 KB
/
test.py
File metadata and controls
42 lines (31 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import unittest
import python_example as m
class SimpleTest(unittest.TestCase):
def test_func(self):
m.func(m.ReduceOp(m.ReduceOp.SUM), m.ReduceOp(m.ReduceOp.UNUSED))
def test_func_auto_call_ctor(self):
m.func(m.ReduceOp.SUM, m.ReduceOp.UNUSED)
def test_options_op_assignment_from_internal_enum(self):
# ======================================================================
# ERROR: test_options_op_assignment_from_internal_enum (__main__.SimpleTest)
# ----------------------------------------------------------------------
# Traceback (most recent call last):
# File "/home/masaki/ghq/github.com/crcrpar/python_example/tests/test.py", line 16, in test_options_op_assignment_from_internal_enum
# opt_a.reduce_op = m.ReduceOp.SUM
# TypeError: (): incompatible function arguments. The following argument types are supported:
# 1. (self: python_example.Options, arg0: python_example.ReduceOp) -> None
# Invoked with: <python_example.Options object at 0x7f4fe49adcf0>, <Kind.SUM: 0>
# ----------------------------------------------------------------------
# Ran 3 tests in 0.000s
#
# FAILED (errors=1)
# note(crcrpar): Implcicit conversion is what might play a role?
opt_a = m.Options()
opt_a.reduce_op = m.ReduceOp.SUM
m.func(opt_a, opt_a)
def test_options_op_assignment_from_internal_enum_WAR(self):
opt_a = m.Options()
opt_a.reduce_op = m.ReduceOp(m.ReduceOp.SUM)
m.func(opt_a, opt_a)
if __name__ == "__main__":
unittest.main()