Skip to content

Commit

Permalink
test for Enable setting property (#15755)
Browse files Browse the repository at this point in the history
Co-authored-by: thomas chaton <thomas@grid.ai>
Co-authored-by: Ethan Harris <ethanwharris@gmail.com>
(cherry picked from commit ba14038)
  • Loading branch information
Borda committed Nov 21, 2022
1 parent 636a46c commit 0e6a3a3
Showing 1 changed file with 3 additions and 10 deletions.
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

0 comments on commit 0e6a3a3

Please sign in to comment.