Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jnumainville committed Aug 16, 2023
1 parent 88fb7a5 commit 8dbd2cc
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 7 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@ on:
tags: [ 'v*' ]

jobs:
test:
runs-on: ubuntu-22.04
strategy:
matrix:
python: [ "3.8", "3.9", "3.10", "3.11" ]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install tox
run: pip install tox

- name: Run tox
run: tox -e py

build-dist:
runs-on: ubuntu-22.04
steps:
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ The wheel is stored in `dist/`.
To test within [deephaven-core](https://github.com/deephaven/deephaven-core), note where this wheel is stored (using `pwd`, for example).
Then, follow the directions in the [deephaven-js-plugins](https://github.com/deephaven/deephaven-js-plugins) repo.

To unit test, run the following command from the root of the repo:
```sh
tox -e py
```

## Usage
Once you have the plugin installed and the server started, the recommended way to import the package mirrors plotly express:
Expand Down
3 changes: 1 addition & 2 deletions src/deephaven/plot/express/deephaven_figure/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ def col_null_mapping(
Yields:
tuple[str, str]: tuple of the form (column name, associated null value)
"""
# TODO: catch "unsupported" types
for col in table.columns:
if col.name in cols:
type_ = col.data_type.j_name
Expand Down Expand Up @@ -172,7 +171,7 @@ def construct_min_dataframe(

update_result = empty_table(1).update(update)

return dhpd.to_pandas(update_result)
return dhpd.to_pandas(update_result, conv_null=False)


def get_data_cols(
Expand Down
2 changes: 1 addition & 1 deletion test/deephaven/plot/express/BaseTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def setup_exporter_mock(cls, MockExporter, MockReference):
cls.exporter = MockExporter()
cls.reference = MockReference()

cls.reference._index = 0
cls.reference.index = 0
cls.exporter.reference.return_value = MockReference()

if __name__ == '__main__':
Expand Down
8 changes: 4 additions & 4 deletions test/deephaven/plot/express/plots/test_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from ..BaseTest import BaseTestCase


class AreaTestCase(BaseTestCase):
def setUp(self) -> None:
from deephaven import new_table
Expand All @@ -20,11 +19,12 @@ def setUp(self) -> None:

def test_basic_area(self):
import src.deephaven.plot.express as dx
from deephaven.constants import NULL_INT

chart = dx.area(self.source, x="X", y="Y").to_dict(self.exporter)
plotly, deephaven = chart["plotly"], chart["deephaven"]

# pop template as we currently do not modify at
# pop template as we currently do not modify it
plotly["layout"].pop("template")

expected_data = [
Expand All @@ -39,9 +39,9 @@ def test_basic_area(self):
'orientation': 'v',
'showlegend': False,
'stackgroup': '1',
'x': [-2147483648],
'x': [NULL_INT],
'xaxis': 'x',
'y': [-2147483648],
'y': [NULL_INT],
'yaxis': 'y',
'type': 'scatter'}
]
Expand Down
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[tox]
isolated_build = True

[testenv]
deps =
deephaven-server
commands =
python -m unittest discover

0 comments on commit 8dbd2cc

Please sign in to comment.