-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure draw/edit tools sync data on bokeh server (#8137)
* Ensure draw/edit tools sync data on bokeh server * Refactored events in edit tools * Add initial PointDrawTool integration tests * Improvements to server selenium testing * Added server selenium tests for PointDrawTool * Improvements for testing drag and doubletap events * Added BoxEditTool selenium tests * Added BoxEditTool server selenium tests * Added approximate comparisons for CDS data * remove unused import
- Loading branch information
1 parent
bf7a804
commit 88a7fe1
Showing
9 changed files
with
760 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#----------------------------------------------------------------------------- | ||
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved. | ||
# | ||
# Powered by the Bokeh Development Team. | ||
# | ||
# The full license is in the file LICENSE.txt, distributed with this software. | ||
#----------------------------------------------------------------------------- | ||
''' Provide tools for executing Selenium tests. | ||
''' | ||
|
||
#----------------------------------------------------------------------------- | ||
# Boilerplate | ||
#----------------------------------------------------------------------------- | ||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
|
||
import logging | ||
log = logging.getLogger(__name__) | ||
|
||
#----------------------------------------------------------------------------- | ||
# Imports | ||
#----------------------------------------------------------------------------- | ||
|
||
# Standard library imports | ||
|
||
# External imports | ||
import numpy as np | ||
|
||
# Bokeh imports | ||
|
||
#----------------------------------------------------------------------------- | ||
# Globals and constants | ||
#----------------------------------------------------------------------------- | ||
|
||
#----------------------------------------------------------------------------- | ||
# General API | ||
#----------------------------------------------------------------------------- | ||
|
||
def cds_data_almost_equal(data1, data2, rtol=1e-09, atol=0.0): | ||
'''Compares data dictionaries containing floats, lists and arrays | ||
Also supports nested lists and arrays | ||
''' | ||
if sorted(data1.keys()) != sorted(data2.keys()): | ||
return False | ||
for c in data1.keys(): | ||
cd1 = data1[c] | ||
cd2 = data2[c] | ||
if len(cd1) != len(cd2): | ||
return False | ||
print(c) | ||
for v1, v2 in zip(cd1, cd2): | ||
print(v1, v2) | ||
if isinstance(v1, (float, int)) and isinstance(v2, (float, int)): | ||
if not np.isclose(v1, v2, rtol, atol): | ||
return False | ||
elif isinstance(v1, (list, np.ndarray)) and isinstance(v2, (list, np.ndarray)): | ||
v1, v2 = np.asarray(v1), np.asarray(v2) | ||
if v1.dtype.kind in 'iufcmM' and v2.kind in 'iufcmM': | ||
if (~np.isclose(v1, v2, rtol, atol)).any(): | ||
return False | ||
elif (v1 != v2).any(): | ||
return False | ||
elif v1 != v2: | ||
return False | ||
return True | ||
|
||
#----------------------------------------------------------------------------- | ||
# Dev API | ||
#----------------------------------------------------------------------------- | ||
|
||
#----------------------------------------------------------------------------- | ||
# Private API | ||
#----------------------------------------------------------------------------- | ||
|
||
#----------------------------------------------------------------------------- | ||
# Code | ||
#----------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.