From eea10380294a83dac13cb33df69e5b7e72f75279 Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Tue, 3 Dec 2019 22:34:54 -0500 Subject: [PATCH] fix #1014 - test for no_update by type rather than identity --- dash/dash.py | 4 ++-- tests/integration/test_integration.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dash/dash.py b/dash/dash.py index d509ea987c..d21371bbbb 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -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 @@ -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 = { diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index 770738a39b..35fe3ad9af 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -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 @@ -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)