- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 366
 
Fix json indent #2546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix json indent #2546
Changes from 2 commits
61f6dd0
              5ab3640
              37f96b0
              5af9d5f
              1e37dd2
              599eefc
              263dac4
              4bac97d
              7a442e1
              1442f4a
              d6ba3f4
              7123ce3
              e3dba80
              865815b
              83259c7
              b218e58
              e262235
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -10,7 +10,7 @@ | |
| from zarr.codecs.bytes import BytesCodec | ||
| from zarr.core.buffer import default_buffer_prototype | ||
| from zarr.core.chunk_key_encodings import DefaultChunkKeyEncoding, V2ChunkKeyEncoding | ||
| from zarr.core.group import parse_node_type | ||
| from zarr.core.group import parse_node_type, GroupMetadata | ||
| from zarr.core.metadata.v3 import ( | ||
| ArrayV3Metadata, | ||
| DataType, | ||
| 
          
            
          
           | 
    @@ -304,6 +304,19 @@ def test_metadata_to_dict( | |
| assert observed == expected | ||
| 
     | 
||
| 
     | 
||
| def test_json_indent(): | ||
| m = GroupMetadata() | ||
| d = m.to_buffer_dict(default_buffer_prototype())["zarr.json"].to_bytes() | ||
| class TestIndentEncoder(json.JSONEncoder): | ||
| def __init__(self, *args: Any, **kwargs: Any) -> None: | ||
| super().__init__(*args, **kwargs) | ||
| self.indent = 2 | ||
| 
     | 
||
| # expected has extra ' ' on each line compared with json.dumps( indent=2) | ||
| expected = json.dumps(json.loads(d), cls=TestIndentEncoder).encode() | ||
                
       | 
||
| assert d == expected | ||
| 
     | 
||
| 
     | 
||
| # @pytest.mark.parametrize("fill_value", [-1, 0, 1, 2932897]) | ||
| # @pytest.mark.parametrize("precision", ["ns", "D"]) | ||
| # async def test_datetime_metadata(fill_value: int, precision: str) -> None: | ||
| 
          
            
          
           | 
    ||
Uh oh!
There was an error while loading. Please reload this page.