forked from kljohann/genpybind
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase-classes-can-be-hidden_test.py
45 lines (31 loc) · 1.25 KB
/
base-classes-can-be-hidden_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# SPDX-FileCopyrightText: 2024 Johann Klähn <[email protected]>
#
# SPDX-License-Identifier: MIT
import base_classes_can_be_hidden as m
BASE_CLASSES = frozenset([m.NestedBase, m.Base, m.Base2])
def test_no_arguments_hides_all():
assert BASE_CLASSES.isdisjoint(m.HideAll.mro())
derived = m.HideAll()
assert not isinstance(derived, (m.Base, m.Base2, m.NestedBase))
def test_unqualified_argument():
derived = m.HideUnqualified()
assert not isinstance(derived, (m.Base, m.NestedBase))
assert isinstance(derived, m.Base2)
def test_qualified_argument():
derived = m.HideQualified()
assert not isinstance(derived, m.Base)
assert isinstance(derived, m.NestedBase)
assert isinstance(derived, m.Base2)
def test_qualified_nested_argument():
derived = m.HideQualifiedNested()
assert not isinstance(derived, m.NestedBase)
assert isinstance(derived, m.Base)
assert isinstance(derived, m.Base2)
def test_hide_multiple():
derived = m.HideMultiple()
assert not isinstance(derived, (m.Base, m.Base2))
assert isinstance(derived, m.NestedBase)
def test_hide_template():
derived = m.HideTemplate()
assert not isinstance(derived, (m.BaseTemplate_int_, m.BaseTemplate_bool_))
assert isinstance(derived, (m.Base))