OpenMetadata/ingestion/tests/unit/utils/test_collaborative_super.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
849 B
Python
Raw Normal View History

import pytest
from metadata.utils.collaborative_super import Root
def test_collaborative_super():
class A(Root):
pass
class B(A):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.b = 2
class C(B):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.num = kwargs["num"]
c = C(num=10)
assert c.num == 10
def test_without_collaborative_super():
class A:
pass
class B(A):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.b = 2
class C(B):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.num = kwargs["num"]
with pytest.raises(TypeError):
C(num=10)