Skip to content

minor test fixes for ipyplotly_integration - #975

Merged
jonmmease merged 145 commits into
ipyplotly_integrationfrom
rebased-test-fixes
Apr 18, 2018
Merged

jonmmease merged 145 commits into
ipyplotly_integrationfrom
rebased-test-fixes

Conversation

@Kully

@Kully Kully commented Mar 15, 2018 •

Copy link
Copy Markdown
Contributor

Minor Test Fixes - Status

NB Tests that are not minor and require changing something in a fundamental way are still checked if all other minor tests in the module are fixed. A description/error message is provided just underneath the bullet point to specify the error message for the unsolved problem

Core

  • test_tools
    • test_make_subplots
      1 F w/ test_two_row_bottom_left
    • test_get_subplots
      same issue as test_make_subplots
    • test_configuration
  • test_plotly
    • test_plot
      __init__() got an unexpected keyword argument '_raise'
    • test_credentials
  • test_stream
  • test_offline
  • test_graph_objs
    • test_annotations
      'Annotations' object has no attribute 'validate'
    • test_append_trace
      same issue as 'test_make_subplots'
    • test_data
      'Data' object has no attribute 'validate'
    • test_error_bars
    • test_figure
      __init__() missing 1 required positional argument: 'class_strs_map'
    • test_frames
      AttributeError: 'Frames' object has no attribute 'to_string'
    • test_get_figure
      AttributeError: 'Figure' object has no attribute 'get_data'
    • test_graph_objs
    • test_graph_objs_tools
      ImportError: cannot import name 'graph_objs_tools'
    • test_plotly_base_classes
      from plotly.graph_objs.graph_objs import PlotlyDict, PlotlyList
    • test_strip_style
      AttributeError: 'Figure' object has no attribute 'strip_style'
    • test_to_string
      AttributeError: 'Figure' object has no attribute 'to_string'
    • test_update
      AttributeError: 'Data' object has no attribute 'update'
  • test_grid
    The 'xsrc' property is a string and must be specified as: - A string
  • test_get_figure
    TypeError: __init__() got an unexpected keyword argument '_raise'
  • test_api

Optional

  • test_tools
    • TestQuiver
    • TestFinanceCharts
    • TestAnnotatedHeatmap
    • TestTable
    • TestGantt
    • Test2D_Density
      ('ncontours', 'colorscale', 'reversescale', 'showscale') not valid in Scatter
  • test_matplotlylib
    • test_annotations
      AssertionError: ['line']['width'] = 1.5 should be 1.0 (I think the issue is just locally due to matplotlib ver ==2.2.2; our tests use matplotlib1.3.1)
    • test_axis_scales
      from plotly.tests.test_optional.test_matplotlylib.data.axis_scales import * causes the error
ValueError: 
    Invalid value of type 'builtins.bool' received for the 'tickmode' property of layout.xaxis
        Received value: False

    The 'tickmode' property is an enumeration that may be specified as:
      - One of the following enumeration values:
            ['auto', 'linear', 'array']
  • test_figure_factory
    • TestDistplot
    • TestStreamline
    • TestDendrogram
      X = np.array([[1, 2, 3, 4], [1, 1, 3, 4], [1, 2, 1, 4], [1, 2, 3, 1]]) dendro = ff.create_dendrogram(X) fails
    • TestTrisurf
    • TestScatterPlotMatrix
    • TestGantt
    • TestViolin (deprecated messages pop up)
    • TestFacetGrid
    • TestBullet
    • TestChoropleth (not installing geopandas, pyshp and shapely)

Current Issues/Test failures from April 12, 2018:

/Users/adamkulidjian/Desktop/Adam/Plotly/plotly.py/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py
AttributeError: 'Scatter' object has no attribute 'pop'
  • no .to_dataframe (test_optional/test_graph_objs)
(venv3.6) adamkulidjian@Adams-Air:~/desktop/adam/plotly/plotly.py/plotly/tests/test_core/test_to$ clenosetests test_make_subplots.py
.......................................................F.
======================================================================
FAIL: test_two_row_bottom_left (plotly.tests.test_core.test_tools.test_make_subplots.TestMakeSubplots)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/adamkulidjian/Desktop/Adam/Plotly/plotly.py/plotly/tests/test_core/test_tools/test_make_subplots.py", line 166, in test_two_row_bottom_left
    self.assertEqual(fig.to_plotly_json(), expected.to_plotly_json())
AssertionError: {'dat[156 chars][0.0, 1.0]}, 'yaxis': {'anchor': 'x', 'domain': [0.0, 0.425]}}} != {'dat[156 chars][0.0, 1.0]}, 'yaxis': {'anchor': 'x', 'domain': [0.575, 1.0]}}}
  {'data': [],
   'layout': {'xaxis': {'anchor': 'y', 'domain': [0.0, 1.0]},
              'xaxis2': {'anchor': 'y2', 'domain': [0.0, 1.0]},
-             'yaxis': {'anchor': 'x', 'domain': [0.0, 0.425]},
?                                                    -------

+             'yaxis': {'anchor': 'x', 'domain': [0.575, 1.0]},
?                                                   +++++++

              'yaxis2': {'anchor': 'x2', 'domain': [0.575, 1.0]}}}
-------------------- >> begin captured stdout << ---------------------
This is the format of your plot grid:
[ (2,1) x2,y2 ]
[ (1,1) x1,y1 ]

-removing the to_dataframe to_string, strip_styles, get_data, and validate methods?

Kully and others added 30 commits February 18, 2018 04:27
Now handles the case where the dashes are scaled, have floating-point values, or were customized with `dashes=(N,M)`.
rewrite changelog for broken choropleth
(matplotlylib) Make convert_dash more robust to changes in matplotlib.
@jonmmease

Copy link
Copy Markdown
Contributor

I don't think @chriddyp and I discussed _raise at all. I don't think we're going to be able to support the _raise=False option directly because validation is pretty baked into the new object hierarchy. Could you try to understand what the use cases are for the _raise=False path? If we understand that we can make an informed decision on whether we can simply remove it, or if there is anything we need to add to continue to support these use cases.

… consistent with favoring validation failure to user\nrelated to TODO #283 Issue\n new valid charts created from old PlotlyImageTest examples
Comment thread plotly/plotly/plotly.py

if raw:
return figure
return tools.get_valid_graph_obj(figure, obj_type='Figure')

@Kully Kully Apr 13, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chriddyp @jmmease
The purpose of this commit is to refactor get_valid_graph_obj function to not remove invalid properties of a figure when .get_figure() is called. I think this is important because:

  • it is consistent with Jon's preference to validation over coercing to default attributes as a default (which I agree with)
  • if a user does want to bypass validation errors, setting raw=True is still an option in the get_figure function
  • one step on the road to finishing Remove graph_objs dependency from tools.py #283 fwiw

What do y'all think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this. The user will either get a dict with whatever was on the server (raw=True) or a fully valid Figure.

Do you think the stripping of invalid properties is something that regular users are going to need? I'm not clear on why we end up with figures with invalid properties on the server in the first place.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered the same thing. In refactoring these tests I noticed that a few of the example figures I pulled from were 4 years old and contained params that are no longer part of the valid params.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be inclined to update the test data, but I'll leave it to you and @chriddyp to decide whether we need to support some kind of legacy property removal.

data=Data(),
layout=Layout(
xaxis1=XAxis(
xaxis=XAxis(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these changes from xaxis1 -> xaxis in the constructors are no longer neccesary after the fix in the following commit:

Rework handling of unknown kwargs in datatype classes (a89dcb5)
@Kully

@jonmmease

Copy link
Copy Markdown
Contributor

@Kully The Key error 'type' exception raised in figure_factory/_scatterplot.py should be fixed by 4fb462f

@Kully

Kully commented Apr 16, 2018 •

Copy link
Copy Markdown
Contributor Author

The Key error 'type' exception raised in figure_factory/_scatterplot.py should be fixed

it is

@Kully

Kully commented Apr 17, 2018

Copy link
Copy Markdown
Contributor Author

@jmmease from plotly.graph_objs.graph_objs import PlotlyDict, PlotlyList doesn't work anymore. Is there a way to import PlotlyDict and PlotlyList?

@jonmmease

Copy link
Copy Markdown
Contributor

@Kully No, PlotlyDict and PlotlyList don't exist anymore

@Kully

Kully commented Apr 17, 2018

Copy link
Copy Markdown
Contributor Author

@Kully No, PlotlyDict and PlotlyList don't exist anymore

ok, I will remove their associated test

@jonmmease

Copy link
Copy Markdown
Contributor

@Kully @chriddyp I'm ready to start working on adding some new tests against the new functionality of graph_objs. So I'm going to go ahead and merge this branch into ipyplotly_integration so I can use some of the new testing utilities.

@jonmmease
jonmmease merged commit f140fd8 into ipyplotly_integration Apr 18, 2018
@chriddyp

Copy link
Copy Markdown
Member

@chriddyp and I chatted about that briefly and I think he was fine with removing the to_dataframe to_string, strip_styles, get_data, and validate methods.

Yup, that sounds right to me 👍

@Kully

Kully commented Apr 23, 2018

Copy link
Copy Markdown
Contributor Author

Yup, that sounds right to me 👍

Does the same go for .update?

@Kully Kully mentioned this pull request Apr 23, 2018
@jonmmease

Copy link
Copy Markdown
Contributor

No, .update is still supported on datatypes. I think the currently failing tests are uses of .update on the deprecated list types.

@nicolaskruchten
nicolaskruchten deleted the rebased-test-fixes branch June 19, 2020 16:14
robertoffmoura pushed a commit to robertoffmoura/matplotlylib that referenced this pull request Dec 3, 2026
* Update CHANGELOG.md

* (matplotlylib) Make convert_dash more robust to changes in matplotlib.

Now handles the case where the dashes are scaled, have floating-point values, or were customized with `dashes=(N,M)`.

* commit

* remove unnecessary data files in tests and robust data-path searching

* pep-8: l -> L variable name

* bump version number up

* remove shapefiles from folders and delete folders

* removed data/ folder and modified choropleth code to match file names

* changelog for fixed 2.4.1

* chelsea's comments

* added fill_percent to params for insert, swap and remove

* html preview not working

* HTML preview now reflects the fill_percent param settings

* tests are working

* make update_default_schema

* udpated changelog, removed TODOs, PEP-8 79 char line limit

* turn off hover for the lines

* 0-padding

* changelog

* update changelog and version number for 2.5.0

* change fill_percent example in doc to fill_percent=20

* sort all node generators to make HTML output consistent for py2 + py3

* dashboards now autosize based on GUI

* update dash workshop announcement 

cc @chriddyp

* version num to 2.5.0

* 4 equal height vertical stacked example in doc string

* rename box_1 to box_a, etc

* remove shapefiles in tests dir

* change version back for testing purposes

* version to 2.5.0

* try bumping npm v in circle.yml to 6.0.0

* Don't crash if figure_factory is imported but pandas isn't installed. Fixes plotly/plotly.py#941

* pr for plotly/plotly.py#958 PR

* add PR reference

* remove a comment

* update plotlyjs for offline

* moved py2.7 test env to last in core environments

* remove ipyplotly folder

* fixed assert Scatter() == dict(type='scatter')

* fixed test_access_top_level in test_figure

* more in test_figures fixes

* remove junk in test_figure.py from before base merge

* BaseFigure and BasePlotlyType inherit from PlotlyBase class

* remove commented validation function

* comment out validate error in test_scatter

* add histogram2dcontour back to graph_reference TRACES

* FigureWidget to OLD_CLASS_NAMES

* add update to Data def in graph_objs//remove to_string in test_update

* fixed test_offline in optional

* test_plotl_mpl fixed

* add py36 to core and optional test envs

* break up datetime tests into multiple ones for better test control

* fixed JSONEncoding errors

* last assert test in test_utils

* print statements for testing  xaxis1

* construct paths to choropleth files intelligently

* update the changelog

* bump version

* changelog comments

* revert to current basedatatypes from plotly/plotly.py#942

* write in helper function for assert_dict_equal

* fix trisurf: hoverinfo needs 'none', not 'None'

* finished a few more classes in figure_factory tests

* remove comment

* change error msg for pip installs in choropleth

* changelog update

* fixed facet grid - annotations now tuples - FacetGrid tests in test_optional

* remove DeprecationWarning from _dendrogram.py

* remove unneeded comments in facet_grid

* change height, width default to np.inf in _Dendogram

* fixed all tests in optional figure_factory

* PEP8 to greyscale list

* fix Quiver tests; remove commented TestDisplot for duplicate

* minor test fixes in test_tools resolved

* playing around with matplotlylib - no success

* chelsea's comment

* fixed test_validate tests in test_core

* fixed offline tests

* change assert error in decorator

* flawed annotations dont return error, so not checking for one

* fix minor tests in test_data

* fix test_error_bars

* null changes

* added white space

* rework mock import for Py3.3+ compat

* deepcopy in assert_fig_equal

* fixed all but one test in make_subplots

* fixed test_api - mock compatib issue

* change errortype to ValueError to fix test

* fix merge for rebase continue

* reverted back to old test in test_figure

* validators update

* fix  test_graph_objs.py in test_core

* fix scatter.py

* fix         self.assert_fig_equal(ohlc.to_plotly_json()['data'][0],

* assert_dict_equal typo

* fix PotlyError -> ValueError for TestTable class

* middle of putting .to_plotly_json in assert_fig_equal

* updated test_tools - numpy arrays to lists

* test_datetimes fixes

* Fix typo (agruments)

* test_offline changes

* do not strip fig of invalid elements wen running .get_figure\nthis is consistent with favoring validation failure to user\nrelated to TODO plotly/plotly.py#283 Issue\n new valid charts created from old PlotlyImageTest examples

* xaxis -> xaxis1 in make_subplots

* xaxis -> xaxis1

* test_plot

* fixed test_figure

* fixed test_append_trace - added assert_fig_equal func clone in test_core

* fixed TestDistplot tests

* removed test_plotly_base_classes test as PlotlyDict/PlotlyList are removed

* fixed tests in test_ff in optional
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants