Fix IntEnum for python 3.11 (#205)

This commit is contained in:
Grzegorz Bokota
2023-09-24 00:23:39 +02:00
committed by GitHub
parent 409d19e5c2
commit 830fe38fb9
2 changed files with 16 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
from enum import Enum
from enum import Enum, IntEnum
import pytest
@@ -36,6 +36,12 @@ class Enum4(Enum):
c_3 = 3
class IntEnum1(IntEnum):
a = 1
b = 2
c = 5
def test_simple_create(qtbot):
enum = QEnumComboBox(enum_class=Enum1)
qtbot.addWidget(enum)
@@ -129,3 +135,10 @@ def test_optional(qtbot):
enum.setCurrentEnum(None)
assert enum.currentText() == NONE_STRING
assert enum.currentEnum() is None
def test_simple_create_int_enum(qtbot):
enum = QEnumComboBox(enum_class=IntEnum1)
qtbot.addWidget(enum)
assert enum.count() == 3
assert [enum.itemText(i) for i in range(enum.count())] == ["a", "b", "c"]