feat: 简化工具箱文案并精简成果下载页
This commit is contained in:
+7
-16
@@ -166,24 +166,15 @@ class TaskIntegrationTest(unittest.TestCase):
|
||||
|
||||
|
||||
class PageTest(unittest.TestCase):
|
||||
def test_result_previews_render_summary_csv_raster_and_geometry(self):
|
||||
from streamlit.testing.v1 import AppTest
|
||||
import numpy as np
|
||||
from marketgrid.raster_math import write_rgba_geotiff
|
||||
def test_result_file_list_is_sorted(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
(root / "summary.json").write_text(json.dumps({"market_timings": [
|
||||
{"market_code": "甲", "elapsed_seconds": 1.5}, {"market_code": "乙", "elapsed_seconds": 2.5}
|
||||
]}), encoding="utf-8")
|
||||
(root / "data.csv").write_text("序号,结果\n1,成功\n", encoding="utf-8-sig")
|
||||
write_rgba_geotiff(root / "signal.tif", np.zeros((2, 3, 4), dtype=np.uint8), 112, 22, 0.1, 0.1)
|
||||
create_gpkg(root / "data.gpkg", "test", '"name" text', [(1, box(112, 22, 112.01, 22.01), ["测试"] )])
|
||||
for path in [*root.iterdir(), tasks.ROOT / "source/GIS.qgz"]:
|
||||
with self.subTest(file=path.name):
|
||||
at = AppTest.from_string(
|
||||
f"from pathlib import Path\nfrom ui.results_page import preview\npreview(Path({str(path)!r}))"
|
||||
).run(timeout=30)
|
||||
self.assertFalse(at.exception, at.exception)
|
||||
(root / "b.zip").write_bytes(b"b")
|
||||
(root / "a.csv").write_text("x\n", encoding="utf-8")
|
||||
(root / ".hidden").write_text("x", encoding="utf-8")
|
||||
from ui.results_page import _file_rows
|
||||
names = [path.name for path in _file_rows(root)]
|
||||
self.assertEqual(names, ["a.csv", "b.zip"])
|
||||
|
||||
def test_uploaded_file_is_stored_once_with_exact_bytes(self):
|
||||
from streamlit.testing.v1 import AppTest
|
||||
|
||||
Reference in New Issue
Block a user