cpython/Lib/tkinter/test/test_tkinter
Ethan Furman dbac8f40e8
bpo-38659: [Enum] add _simple_enum decorator (GH-25285)
add:

_simple_enum decorator to transform a normal class into an enum
_test_simple_enum function to compare
_old_convert_ to enable checking _convert_ generated enums
_simple_enum takes a normal class and converts it into an enum:

@simple_enum(Enum)
class Color:
    RED = 1
    GREEN = 2
    BLUE = 3

_old_convert_ works much like _convert_ does, using the original logic:

# in a test file
import socket, enum
CheckedAddressFamily = enum._old_convert_(
        enum.IntEnum, 'AddressFamily', 'socket',
        lambda C: C.isupper() and C.startswith('AF_'),
        source=_socket,
        )

test_simple_enum takes a traditional enum and a simple enum and
compares the two:

# in the REPL or the same module as Color
class CheckedColor(Enum):
    RED = 1
    GREEN = 2
    BLUE = 3

_test_simple_enum(CheckedColor, Color)

_test_simple_enum(CheckedAddressFamily, socket.AddressFamily)

Any important differences will raise a TypeError
2021-04-19 18:04:53 -07:00
..
__init__.py
test_colorchooser.py bpo-33289: Return RGB triplet of ints instead of floats from tkinter.colorchooser (GH-6578) 2021-01-21 21:14:04 +02:00
test_font.py bpo-42759: Fix equality comparison of Variable and Font in Tkinter (GH-23968) 2020-12-29 12:56:55 +02:00
test_geometry_managers.py
test_images.py bpo-42630: Improve error reporting in Tkinter for absent default root (GH-23781) 2020-12-19 12:17:08 +02:00
test_loadtk.py bpo-40275: Use new test.support helper submodules in tests (GH-21743) 2020-08-06 13:51:29 +02:00
test_messagebox.py bpo-42721: Improve using simple dialogs without root window (GH-23897) 2020-12-25 20:19:20 +02:00
test_misc.py bpo-38659: [Enum] add _simple_enum decorator (GH-25285) 2021-04-19 18:04:53 -07:00
test_simpledialog.py bpo-42721: Improve using simple dialogs without root window (GH-23897) 2020-12-25 20:19:20 +02:00
test_text.py
test_variables.py bpo-42759: Fix equality comparison of Variable and Font in Tkinter (GH-23968) 2020-12-29 12:56:55 +02:00
test_widgets.py Rename Tkinter tests for widget options (GH-23944) 2020-12-26 00:10:29 +02:00