File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+
3+ from typing import Final
4+
5+ import pytest
6+ from numpydoc .docscrape import NumpyDocString
7+
8+ from zarr .api import asynchronous , synchronous
9+
10+ MATCHED_EXPORT_NAMES : Final [tuple [str , ...]] = tuple (
11+ sorted (set (synchronous .__all__ ) | set (asynchronous .__all__ ))
12+ )
13+ MATCHED_CALLABLE_NAMES : Final [tuple [str , ...]] = tuple (
14+ x for x in MATCHED_EXPORT_NAMES if callable (getattr (synchronous , x ))
15+ )
16+
17+
18+ @pytest .mark .parametrize ("callable_name" , MATCHED_CALLABLE_NAMES )
19+ def test_create_docstrings (callable_name : str ) -> None :
20+ """
21+ Tests that the docstrings for the sync and async define identical parameters.
22+ """
23+ callable_a = getattr (synchronous , callable_name )
24+ callable_b = getattr (asynchronous , callable_name )
25+ if callable_a .__doc__ is None :
26+ assert callable_b .__doc__ is None
27+ else :
28+ params_a = NumpyDocString (callable_a .__doc__ )["Parameters" ]
29+ params_b = NumpyDocString (callable_b .__doc__ )["Parameters" ]
30+ assert params_a == params_b
You can’t perform that action at this time.
0 commit comments