Skip to content

Commit

Permalink
Sort keys in json representation of requests
Browse files Browse the repository at this point in the history
  • Loading branch information
matrss committed Apr 15, 2024
1 parent c8a609f commit 4bc071f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/datalad_cds/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def to_dict(self) -> Dict[str, Any]:
}

def to_json(self) -> str:
return json.dumps(self.to_dict(), separators=(",", ":"))
return json.dumps(self.to_dict(), separators=(",", ":"), sort_keys=True)

def to_url(self) -> str:
json_spec = self.to_json()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_download_cds.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ def test_download_cds_lazy(
)
assert (
os.readlink(dataset.pathobj / "download.grib")
== ".git/annex/objects/2x/JF/URL--cds&cv1-eyJkYXRhc2V0IjoicmVhbmFs-b66f78bc76f33a53e89a1c679e330019/URL--cds&cv1-eyJkYXRhc2V0IjoicmVhbmFs-b66f78bc76f33a53e89a1c679e330019"
== ".git/annex/objects/5J/pV/URL--cds&cv1-eyJkYXRhc2V0IjoicmVhbmFs-77566133ebfe9220aefbeed5a58b6972/URL--cds&cv1-eyJkYXRhc2V0IjoicmVhbmFs-77566133ebfe9220aefbeed5a58b6972"
)

0 comments on commit 4bc071f

Please sign in to comment.