Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dgarcia:python312:numeric
python-plotly
plotly-pr4622-np2.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File plotly-pr4622-np2.patch of Package python-plotly
From 0199582127111c453db70a0133db8c64baca7c40 Mon Sep 17 00:00:00 2001 From: Ben Greiner <code@bnavigator.de> Date: Sun, 2 Jun 2024 16:43:06 +0200 Subject: [PATCH 1/3] Remove np.nan and np.inf aliases no longer present in numpy2 --- .../tests/test_optional/test_utils/test_utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py index cf32e1bdf..d7d982e63 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py @@ -34,7 +34,7 @@ if matplotlylib: ## JSON encoding numeric_list = [1, 2, 3] -np_list = np.array([1, 2, 3, np.NaN, np.NAN, np.Inf, dt(2014, 1, 5)]) +np_list = np.array([1, 2, 3, np.nan, np.inf, dt(2014, 1, 5)]) mixed_list = [ 1, "A", @@ -45,7 +45,7 @@ mixed_list = [ dt_list = [dt(2014, 1, 5), dt(2014, 1, 5, 1, 1, 1), dt(2014, 1, 5, 1, 1, 1, 1)] df = pd.DataFrame( - columns=["col 1"], data=[1, 2, 3, dt(2014, 1, 5), pd.NaT, np.NaN, np.Inf] + columns=["col 1"], data=[1, 2, 3, dt(2014, 1, 5), pd.NaT, np.nan, np.inf] ) rng = pd.date_range("1/1/2011", periods=2, freq="H") @@ -184,7 +184,7 @@ class TestJSONEncoder(TestCase): assert ( js1 == '{"type": "scatter3d", "x": [1, 2, 3], ' - '"y": [1, 2, 3, null, null, null, "2014-01-05T00:00:00"], ' + '"y": [1, 2, 3, null, null, "2014-01-05T00:00:00"], ' '"z": [1, "A", "2014-01-05T00:00:00", ' '"2014-01-05T01:01:01", "2014-01-05T01:01:01.000001"]}' ) @@ -195,9 +195,9 @@ class TestJSONEncoder(TestCase): _json.dumps(figure, cls=utils.PlotlyJSONEncoder, sort_keys=True) # Test data wasn't mutated - np_array = np.array([1, 2, 3, np.NaN, np.NAN, np.Inf, dt(2014, 1, 5)]) + np_array = np.array([1, 2, 3, np.nan, np.inf, dt(2014, 1, 5)]) for k in range(len(np_array)): - if k in [3, 4]: + if k == 3: # check NaN assert np.isnan(np_list[k]) and np.isnan(np_array[k]) else: @@ -237,7 +237,7 @@ class TestJSONEncoder(TestCase): # Test that data wasn't mutated assert_series_equal( df["col 1"], - pd.Series([1, 2, 3, dt(2014, 1, 5), pd.NaT, np.NaN, np.Inf], name="col 1"), + pd.Series([1, 2, 3, dt(2014, 1, 5), pd.NaT, np.nan, np.inf], name="col 1"), ) j2 = _json.dumps(df.index, cls=utils.PlotlyJSONEncoder) -- 2.45.1 From f88554113e8cf55a1d756c3f0d33b92a891d0475 Mon Sep 17 00:00:00 2001 From: Ben Greiner <code@bnavigator.de> Date: Sun, 2 Jun 2024 16:48:34 +0200 Subject: [PATCH 2/3] Avoid putting 255 into int8 due to new numpy 2 type promotion rules --- .../plotly/plotly/tests/test_optional/test_px/test_imshow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py b/packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py index c2e863c84..d8f9ad98c 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_px/test_imshow.py @@ -341,7 +341,7 @@ def test_imshow_source_dtype_zmax(dtype, contrast_rescaling): assert ( np.abs( np.max(decode_image_string(fig.data[0].source)) - - 255 * img.max() / np.iinfo(dtype).max + - np.int64(255) * img.max() / np.iinfo(dtype).max ) < 1 ) -- 2.45.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor