Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test for Enable setting property #15755

Merged
merged 14 commits into from Nov 21, 2022
13 changes: 3 additions & 10 deletions tests/tests_app/core/test_lightning_app.py
Expand Up @@ -1114,7 +1114,6 @@ class FlowValue(LightningFlow):
def __init__(self):
super().__init__()
self._value = None
self._has_found = False

@property
def value(self):
Expand All @@ -1125,19 +1124,13 @@ def value(self, value):
self._value = value

def run(self):
if self.value is None:
self.value = True

def __setattr__(self, name, value):
if name == "_value" and value is True:
self._has_found = True
super().__setattr__(name, value)
self.value = True


def test_lightning_flow_properties():
"""Validates setting properties to the LightningFlow properly calls property.fset."""

flow = FlowValue()
assert not flow._has_found
assert flow._value is None
flow.run()
assert flow._has_found
assert flow._value is True