mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 15:12:01 +00:00
d41a273031
This makes the Python interface mirror the C++ interface: pybind11-exported scoped enums aren't directly comparable to the underlying integer values.
57 lines
1.6 KiB
Plaintext
57 lines
1.6 KiB
Plaintext
<class 'example.EMyEnumeration'>
|
|
EMyEnumeration.EFirstEntry
|
|
EMyEnumeration.ESecondEntry
|
|
EMyEnumeration.EFirstEntry
|
|
test_function()
|
|
False
|
|
test_function(7)
|
|
3.5
|
|
test_function(enum=1)
|
|
None
|
|
test_function(enum=2)
|
|
None
|
|
test_ecenum(ECMyEnum::Three)
|
|
test_ecenum(ECMyEnum::Two)
|
|
Good: caught expected TypeError exceptions for scoped enum ==/!= int comparisons
|
|
Good: no TypeError exception for unscoped enum ==/!= int comparisions
|
|
enum->integer = 2
|
|
integer->enum = EMyEnumeration.ESecondEntry
|
|
A constant = 14
|
|
<class 'example.EMode'>
|
|
EMode.EFirstMode
|
|
EMode.EFirstMode
|
|
ExampleWithEnum::test_function(enum=1)
|
|
ExampleWithEnum::test_function(enum=1)
|
|
ExampleWithEnum::test_function(enum=1)
|
|
Equality test 1: True
|
|
ExampleWithEnum::test_function(enum=1)
|
|
ExampleWithEnum::test_function(enum=1)
|
|
Inequality test 1: False
|
|
ExampleWithEnum::test_function(enum=1)
|
|
ExampleWithEnum::test_function(enum=2)
|
|
Equality test 2: False
|
|
ExampleWithEnum::test_function(enum=1)
|
|
ExampleWithEnum::test_function(enum=2)
|
|
Inequality test 2: True
|
|
ExampleWithEnum::test_function(enum=1)
|
|
ExampleWithEnum::test_function(enum=1)
|
|
Equality test 3: True
|
|
ExampleWithEnum::test_function(enum=1)
|
|
ExampleWithEnum::test_function(enum=1)
|
|
Inequality test 3: False
|
|
ExampleWithEnum::test_function(enum=1)
|
|
ExampleWithEnum::test_function(enum=2)
|
|
Equality test 4: False
|
|
ExampleWithEnum::test_function(enum=1)
|
|
ExampleWithEnum::test_function(enum=2)
|
|
Inequality test 4: True
|
|
ExampleWithEnum::test_function(enum=1)
|
|
ExampleWithEnum::test_function(enum=2)
|
|
ExampleWithEnum::test_function(enum=1)
|
|
ExampleWithEnum::test_function(enum=2)
|
|
Hashing test = {EMode.EFirstMode: 3, EMode.ESecondMode: 4}
|
|
bytes[0]=1
|
|
bytes[1]=0
|
|
bytes[2]=2
|
|
bytes[3]=0
|