FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
zarr-python/tests/test_errors.py at main · oldrobotdev/zarr-python · GitHub
oldrobotdev
/
zarr-python
Public
forked from
zarr-developers/zarr-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
zarr-python
/
tests
/
test_errors.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
101 lines (80 loc) · 3.09 KB
Breadcrumbs
zarr-python
/
tests
/
test_errors.py
Copy path
File metadata and controls
101 lines (80 loc) · 3.09 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
"""Test errors"""
import
pytest
from
zarr
.
errors
import
(
ArrayNotFoundError
,
ContainsArrayAndGroupError
,
ContainsArrayError
,
ContainsGroupError
,
DataTypeValidationError
,
GroupNotFoundError
,
MetadataValidationError
,
NodeTypeValidationError
,
ZarrDeprecationWarning
,
)
def
test_group_not_found_error
()
->
None
:
"""
Test that calling GroupNotFoundError with multiple arguments returns a formatted string.
This is deprecated behavior.
"""
err
=
GroupNotFoundError
(
"store"
,
"path"
)
assert
str
(
err
)
==
"No group found in store 'store' at path 'path'"
def
test_array_not_found_error
()
->
None
:
"""
Test that calling ArrayNotFoundError with multiple arguments returns a formatted string.
This is deprecated behavior.
"""
err
=
ArrayNotFoundError
(
"store"
,
"path"
)
assert
str
(
err
)
==
"No array found in store 'store' at path 'path'"
def
test_metadata_validation_error
()
->
None
:
"""
Test that calling MetadataValidationError with multiple arguments returns a formatted string.
This is deprecated behavior.
"""
err
=
MetadataValidationError
(
"a"
,
"b"
,
"c"
)
assert
str
(
err
)
==
"Invalid value for 'a'. Expected 'b'. Got 'c'."
def
test_contains_group_error
()
->
None
:
"""
Test that calling ContainsGroupError with multiple arguments returns a formatted string.
This is deprecated behavior.
"""
err
=
ContainsGroupError
(
"store"
,
"path"
)
assert
str
(
err
)
==
"A group exists in store 'store' at path 'path'."
def
test_contains_array_error
()
->
None
:
"""
Test that calling ContainsArrayError with multiple arguments returns a formatted string.
This is deprecated behavior.
"""
err
=
ContainsArrayError
(
"store"
,
"path"
)
assert
str
(
err
)
==
"An array exists in store 'store' at path 'path'."
def
test_contains_array_and_group_error
()
->
None
:
"""
Test that calling ContainsArrayAndGroupError with multiple arguments returns a formatted string.
This is deprecated behavior.
"""
err
=
ContainsArrayAndGroupError
(
"store"
,
"path"
)
assert
str
(
err
)
==
(
"Array and group metadata documents (.zarray and .zgroup) were both found in store 'store' "
"at path 'path'. Only one of these files may be present in a given directory / prefix. "
"Remove the .zarray file, or the .zgroup file, or both."
)
def
test_node_type_validation_error
()
->
None
:
"""
Test that calling NodeTypeValidationError with multiple arguments returns a formatted string.
This is deprecated behavior.
"""
err
=
NodeTypeValidationError
(
"a"
,
"b"
,
"c"
)
assert
str
(
err
)
==
"Invalid value for 'a'. Expected 'b'. Got 'c'."
@
pytest
.
mark
.
parametrize
(
"module_name"
,
[
"zarr.core.dtype.common"
,
"zarr.core.dtype"
,
"zarr.dtype"
,
],
)
def
test_data_type_validation_error_deprecated_import
(
module_name
:
str
)
->
None
:
import
importlib
module
=
importlib
.
import_module
(
module_name
)
with
pytest
.
warns
(
ZarrDeprecationWarning
,
match
=
f"
{
module_name
}
"
):
cls
=
module
.
DataTypeValidationError
assert
cls
is
DataTypeValidationError
Back
|
FazBrowse Home
|
New Git URL