OXIESEC PANEL
- Current Dir:
/
/
opt
/
alt
/
python311
/
lib
/
python3.11
/
site-packages
/
tests
/
functions
Server IP: 2a02:4780:11:1594:0:ef5:22d7:a
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/14/2024 03:19:10 PM
rwxr-xr-x
📄
__init__.py
0 bytes
05/14/2024 03:18:36 PM
rw-r--r--
📁
__pycache__
-
05/14/2024 03:18:36 PM
rwxr-xr-x
📄
test_common_ancestor.py
1.24 KB
05/14/2024 03:18:36 PM
rw-r--r--
📄
test_get_args_and_return_type.py
1.26 KB
05/14/2024 03:18:36 PM
rw-r--r--
📄
test_get_mro.py
779 bytes
05/14/2024 03:18:36 PM
rw-r--r--
📄
test_get_type.py
3.42 KB
05/14/2024 03:18:36 PM
rw-r--r--
📄
test_get_type_hints_of_callable.py
1.64 KB
05/14/2024 03:18:36 PM
rw-r--r--
📄
test_instance_of.py
5.61 KB
05/14/2024 03:18:36 PM
rw-r--r--
📄
test_is_optional_type.py
553 bytes
05/14/2024 03:18:36 PM
rw-r--r--
📄
test_is_type_annotation.py
1.03 KB
05/14/2024 03:18:36 PM
rw-r--r--
📄
test_origin_and_alias.py
1.97 KB
05/14/2024 03:18:36 PM
rw-r--r--
📄
test_subclass_of.py
4.24 KB
05/14/2024 03:18:36 PM
rw-r--r--
Editing: test_common_ancestor.py
Close
from typing import Type from unittest import TestCase from typish import common_ancestor, common_ancestor_of_types, NoneType class A: pass class B(A): pass class C(B): pass class D(C): pass class E(D): pass class TestCommonAncestor(TestCase): def test_common_ancestor(self): self.assertEqual(C, common_ancestor(E(), C(), D(), E())) self.assertEqual(B, common_ancestor(E(), C(), D(), E(), B())) self.assertEqual(object, common_ancestor(E(), C(), D(), E(), B(), 42)) def test_common_ancestor_of_types(self): self.assertEqual(C, common_ancestor_of_types(E, C, D, E)) self.assertEqual(object, common_ancestor_of_types(int, str)) common_ancestor_of_types(list, tuple) def test_common_ancestor_of_typing_types(self): self.assertEqual(type, common_ancestor_of_types(Type[int], Type[str])) def test_common_acestor_of_collections(self): self.assertEqual(list, common_ancestor([1, 2, 3], ['a', 'b', 'c'])) def test_special_args(self): self.assertEqual(NoneType, common_ancestor(None, None)) self.assertEqual(int, common_ancestor(42)) def test_invalid(self): with self.assertRaises(TypeError): common_ancestor()