Skip to content

Commit

Permalink
test: that empty filters list is serialized as 'null'
Browse files Browse the repository at this point in the history
* this test currently fails

see #51
  • Loading branch information
bogovicj committed Oct 1, 2024
1 parent cc42161 commit 8ba3a43
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/java/org/janelia/saalfeldlab/n5/zarr/N5ZarrTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ public void testReadZarrNestedPython() throws IOException, InterruptedException
@Test
public void testRawCompressorNullInZarray() throws IOException, ParseException, URISyntaxException {

// GsonBuilder's default value for serializeNulls is false
final ZarrKeyValueWriter n5 = (ZarrKeyValueWriter) createTempN5Writer();
n5.createDataset(
testZarrDatasetName,
Expand All @@ -704,6 +705,27 @@ public void testRawCompressorNullInZarray() throws IOException, ParseException,
}
}

@Test
public void testFiltersNullInZarray() throws IOException, ParseException, URISyntaxException {

// GsonBuilder's default value for serializeNulls is false
final ZarrKeyValueWriter n5 = (ZarrKeyValueWriter)createTempN5Writer();
n5.createDataset(
testZarrDatasetName,
new long[]{1, 2, 3},
new int[]{1, 2, 3},
DataType.UINT16,
new RawCompression());
final String zarrayLocation = n5.keyValueAccess.compose(n5.uri, testZarrDatasetName, ".zarray");
final LockedChannel zarrayChannel = n5.keyValueAccess.lockForReading(zarrayLocation);
final JSONParser jsonParser = new JSONParser();
try (Reader reader = zarrayChannel.newReader()) {
final JSONObject zarray = (JSONObject)jsonParser.parse(reader);
final JSONObject filters = (JSONObject)zarray.get("filters");
assertNull(filters);
}
}

@Test
@Override
public void testAttributes() {
Expand Down

0 comments on commit 8ba3a43

Please sign in to comment.