Skip to content

Commit

Permalink
Test new type metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
axelboc committed Jan 24, 2024
1 parent 0f21787 commit cd7fdfc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
pip install -e .[dev]
```

will install `h5grove` in editable mode with all the linting/formating/testing packages. This will also install the [flask](https://flask.palletsprojects.com/en/) and [tornado](https://www.tornadoweb.org/en/stable/) packages as they are needed to build the documentation.
will install `h5grove` in editable mode with all the linting/formating/testing packages. This will also install the [fastapi](https://fastapi.tiangolo.com/), [flask](https://flask.palletsprojects.com/en/) and [tornado](https://www.tornadoweb.org/en/stable/) packages as they are needed to build the documentation and test the project.

## Linting

Expand Down
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ install_requires =

[options.extras_require]
fastapi =
fastapi
fastapi
pydantic > 2
pydantic-settings
uvicorn
Expand All @@ -35,14 +35,15 @@ flask =
Flask-Compress
Flask-Cors
tornado =
tornado
tornado
dev =
black
bump2version
check-manifest
flake8
h5grove[fastapi]
h5grove[flask]
h5grove[tornado]
invoke
mypy
myst-parser
Expand Down
4 changes: 2 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def lint(c):


@task
def test(c):
def test(c, verbose=False, keyword=""):
"""Test without benchmark"""
c.run("pytest --benchmark-skip")
c.run("pytest --benchmark-skip" + (" -vv" if verbose else "") + ((" -k" + keyword) if keyword else ""))


@task
Expand Down
31 changes: 26 additions & 5 deletions test/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ def test_meta_on_chunked_compressed_dataset(self, server):
assert content == {
"attributes": [],
"chunks": [5, 5],
"dtype": "<f8",
"filters": [{"id": 2, "name": "shuffle"}, {"id": 1, "name": "deflate"}],
"kind": "dataset",
"name": "data",
"shape": [10, 10],
"type": {"class": 1, "dtype": "<f8", "size": 8, "order": 0},
}

def test_meta_on_compound_dataset(self, server):
Expand All @@ -161,11 +161,32 @@ def test_meta_on_compound_dataset(self, server):
assert content == {
"attributes": [],
"chunks": None,
"dtype": {"name": "|S10", "age": "<i4", "weight": "<f4"},
"filters": None,
"kind": "dataset",
"name": "dogs",
"shape": [2],
"type": "dataset",
"type": {
"class": 6,
"dtype": {"age": "<i4", "name": "|S10", "weight": "<f4"},
"size": 18,
"members": {
"age": {
"class": 0,
"dtype": "<i4",
"size": 4,
"order": 0,
"sign": 1,
},
"name": {
"class": 3,
"dtype": "|S10",
"size": 10,
"cset": 0,
"vlen": False,
},
"weight": {"class": 1, "dtype": "<f4", "size": 4, "order": 0},
},
},
}

def test_meta_on_group(self, server):
Expand Down Expand Up @@ -221,11 +242,11 @@ def test_meta_on_valid_ext_link(self, server, resolve_links):
assert content == {
"attributes": [],
"chunks": None,
"dtype": "<f8",
"filters": None,
"kind": "dataset",
"name": "ext_link",
"shape": [10],
"type": {"class": 1, "dtype": "<f8", "order": 0, "size": 8},
}

def test_stats_on_negative_scalar(self, server):
Expand Down Expand Up @@ -358,9 +379,9 @@ def test_meta_on_broken_soft_link(self, server, resolve_links):
response = server.get(url)
content = decode_response(response)
assert content == {
"kind": "soft_link",
"name": "link",
"target_path": "not_an_entity",
"type": "soft_link",
}

def test_403_on_file_without_read_permission(self, server):
Expand Down

0 comments on commit cd7fdfc

Please sign in to comment.