forked from equinor/webviz-subsurface
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix leaflet python example and add test (equinor#721)
Co-authored-by: Håvard Bjerke <[email protected]>
- Loading branch information
1 parent
c83145f
commit 21525d1
Showing
2 changed files
with
31 additions
and
2 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,29 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
# | ||
# Copyright (C) 2020 - Equinor ASA. | ||
|
||
import json | ||
|
||
import dash | ||
import webviz_subsurface_components | ||
|
||
|
||
# Basic test for the component rendering. | ||
def test_render_leaflet_map(dash_duo: dash.testing.composite.DashComposite) -> None: | ||
|
||
with open( | ||
"react/src/demo/example-data/leaflet-map.json", encoding="utf8" | ||
) as json_file: | ||
leaflet_data = json.load(json_file)["layers"][1:] | ||
|
||
app = dash.Dash(__name__) | ||
app.layout = dash.html.Div( | ||
style={"height": "90vh"}, | ||
children=webviz_subsurface_components.LeafletMap( | ||
id="leaflet", minZoom=-5, crs="simple", layers=leaflet_data | ||
), | ||
) | ||
dash_duo.start_server(app) | ||
assert dash_duo.get_logs() == [] # Console should have no errors |