Skip to content

Commit

Permalink
fix #1014 - test for no_update by type rather than identity
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcjohnson authored and chriddyp committed Jan 8, 2020
1 parent 0e6ac07 commit eea1038
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dash/dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ def add_context(*args, **kwargs):
has_update = False
for i, o in enumerate(output):
val = output_value[i]
if val is not no_update:
if not isinstance(val, _NoUpdate):
has_update = True
o_id, o_prop = o.component_id, o.component_property
component_ids[o_id][o_prop] = val
Expand All @@ -1367,7 +1367,7 @@ def add_context(*args, **kwargs):

response = {"response": component_ids, "multi": True}
else:
if output_value is no_update:
if isinstance(output_value, _NoUpdate):
raise exceptions.PreventUpdate

response = {
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import datetime
import time
import pytest
from copy import copy

from bs4 import BeautifulSoup
from selenium.webdriver.common.keys import Keys
Expand Down Expand Up @@ -527,7 +528,8 @@ def show_clicks(n):
return [
no_update if n and n > 4 else n,
no_update if n and n > 2 else n,
no_update,
# make a new instance, to mock up caching and restoring no_update
copy(no_update),
]

dash_duo.start_server(app)
Expand Down

0 comments on commit eea1038

Please sign in to comment.