Skip to content

Commit eee9360

Browse files
Update __init__ calls to new init hook
1 parent d758d89 commit eee9360

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

tests/data/lint.cgx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ from PySide6.QtWidgets import QBoxLayout
7474

7575

7676
class Directives(cg.Component):
77-
def __init__(self, *args, **kwargs):
78-
super().__init__(*args, **kwargs)
77+
def init(self):
7978
self.state["other_text"] = "Other"
8079
self.state["counter"] = 0
8180
self.state["animals"] = []

tests/test_linter.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ def test_lint_invalid_code():
4444
4545
4646
class Node(Component):
47-
def __init__(self, *args, **kwargs):
48-
super().__init__(*args, **kwargs)
47+
def init(self):
4948
self.message = undefined_variable
5049
</script>
5150
""".lstrip("\n")
@@ -60,7 +59,7 @@ def __init__(self, *args, **kwargs):
6059
assert "Undefined name `undefined_variable`" in diagnostic.message, (
6160
diagnostic.message
6261
)
63-
assert diagnostic.line == 11
62+
assert diagnostic.line == 10
6463
assert diagnostic.column == 23
6564

6665

@@ -154,8 +153,7 @@ def test_lint_unused_import():
154153
155154
156155
class Directives(cg.Component):
157-
def __init__(self, *args, **kwargs):
158-
super().__init__(*args, **kwargs)
156+
def init(self):
159157
self.state["other_text"] = "Other"
160158
self.state["counter"] = 0
161159
self.state["animals"] = []

0 commit comments

Comments
 (0)