Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Sep 14, 2023
1 parent 1a2bf7f commit 3dce049
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions src/titiler/core/tests/test_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,36 +124,40 @@ def test_TilerFactory():
assert response.headers["content-type"] == "image/png"

# Dict
cmap = urlencode(
{
response = client.get(
"/tiles/8/84/47.png",
params={
"url": f"{DATA_DIR}/cog.tif",
"bidx": 1,
"colormap": json.dumps(
{
"1": [58, 102, 24, 255],
"2": [100, 177, 41],
"3": "#b1b129",
"4": "#ddcb9aFF",
}
)
}
),
},
)
response = client.get(f"/tiles/8/84/47.png?url={DATA_DIR}/cog.tif&bidx=1&{cmap}")
assert response.status_code == 200
assert response.headers["content-type"] == "image/png"

# Intervals
cmap = urlencode(
{
response = client.get(
"/tiles/8/84/47.png",
params={
"url": f"{DATA_DIR}/cog.tif",
"bidx": 1,
"colormap": json.dumps(
[
# ([min, max], [r, g, b, a])
([1, 2], [0, 0, 0, 255]),
([2, 3], [255, 255, 255, 255]),
([3, 1000], [255, 0, 0, 255]),
]
)
}
),
},
)
response = client.get(f"/tiles/8/84/47.png?url={DATA_DIR}/cog.tif&bidx=1&{cmap}")
assert response.status_code == 200
assert response.headers["content-type"] == "image/png"

Expand Down Expand Up @@ -1522,21 +1526,21 @@ def test_AutoFormat_Colormap():
app.include_router(cog.router)

with TestClient(app) as client:

cmap = urlencode(
{
response = client.get(
"/preview",
params={
"url": f"{DATA_DIR}/cog.tif",
"bidx": 1,
"colormap": json.dumps(
[
# ([min, max], [r, g, b, a])
([0, 1], [255, 255, 255, 0]), # should be masked
([2, 6000], [255, 0, 0, 255]),
([6001, 300000], [0, 255, 0, 255]),
]
)
}
),
},
)

response = client.get(f"/preview?url={DATA_DIR}/cog.tif&bidx=1&{cmap}")
assert response.status_code == 200
assert response.headers["content-type"] == "image/png"
with MemoryFile(response.content) as mem:
Expand Down

1 comment on commit 3dce049

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'TiTiler performance Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.

Benchmark suite Current: 3dce049 Previous: 255fd49 Ratio
WebMercator longest_transaction 0.13 s 0.08 s 1.63

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.