HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/tests/functions/test_get_mro.py
import typing
from typing import Union
from unittest import TestCase

from typish import get_mro


class A:
    ...


class B(A):
    ...


class TestGetMRO(TestCase):
    def test_get_mro(self):
        mro_b = get_mro(B)
        self.assertTupleEqual((B, A, object), mro_b)

    def test_get_mro_union(self):
        mro_u = get_mro(Union[int, str])

        # Below is to stay compatible with Python 3.5+
        super_cls = getattr(typing, '_GenericAlias',
                            getattr(typing, 'GenericMeta', None))
        expected = (typing.Union, super_cls, object)

        self.assertTupleEqual(expected, mro_u)

    def test_get_mro_object(self):
        mro_b = get_mro(B())
        self.assertTupleEqual((B, A, object), mro_b)