MCPcopy Create free account
hub / github.com/pybind/pybind11 / test_mi_static_properties

Function test_mi_static_properties

tests/test_multiple_inheritance.py:242–263  ·  view source on GitHub ↗

Mixing bases with and without static properties should be possible and the result should be independent of base definition order

()

Source from the content-addressed store, hash-verified

240
241
242def test_mi_static_properties():
243 """Mixing bases with and without static properties should be possible
244 and the result should be independent of base definition order"""
245
246 for d in (m.VanillaStaticMix1(), m.VanillaStaticMix2()):
247 assert d.vanilla() == "Vanilla"
248 assert d.static_func1() == "WithStatic1"
249 assert d.static_func2() == "WithStatic2"
250 assert d.static_func() == d.__class__.__name__
251
252 m.WithStatic1.static_value1 = 1
253 m.WithStatic2.static_value2 = 2
254 assert d.static_value1 == 1
255 assert d.static_value2 == 2
256 assert d.static_value == 12
257
258 d.static_value1 = 0
259 assert d.static_value1 == 0
260 d.static_value2 = 0
261 assert d.static_value2 == 0
262 d.static_value = 0
263 assert d.static_value == 0
264
265
266def test_mi_dynamic_attributes():

Callers

nothing calls this directly

Calls 4

vanillaMethod · 0.80
static_func1Method · 0.80
static_func2Method · 0.80
static_funcMethod · 0.45

Tested by

no test coverage detected