feat: 移除全量包中的小区数据

This commit is contained in:
nixevol
2026-09-21 09:41:24 +08:00
parent 75af8f9f76
commit cab073bc0c
9 changed files with 25 additions and 59 deletions
+13 -15
View File
@@ -567,21 +567,19 @@ class QgisProjectTest(unittest.TestCase):
def test_market_and_summary_projects_have_no_user_count_layer(self):
with tempfile.TemporaryDirectory() as temp_dir:
for include_cell_data in (False, True):
with self.subTest(include_cell_data=include_cell_data):
output = Path(temp_dir) / f"GIS-{include_cell_data}.qgz"
qgis.copy_gis_project_to_market(
config.GIS_PROJECT_SOURCE, output,
models.MarketFeature(1, "1-test", "test", box(0, 0, 1, 1)),
None, include_cell_data=include_cell_data,
)
with zipfile.ZipFile(output) as archive:
xml = archive.read("GIS.qgs")
self.assertNotIn(config.USER_COUNT_OUTPUT_FILENAME, xml.decode("utf-8"))
names = [item.get("name") for item in ET.fromstring(xml).iter("layer-tree-layer")]
self.assertEqual("CellData" in names, include_cell_data)
self.assertIn(Path(config.COMPETITOR_SIGNAL_OUTPUT_FILENAME).stem, names)
self.assertEqual(names[-2:], ["GoogleCN", "必应地图"])
output = Path(temp_dir) / "GIS.qgz"
qgis.copy_gis_project_to_market(
config.GIS_PROJECT_SOURCE, output,
models.MarketFeature(1, "1-test", "test", box(0, 0, 1, 1)),
None, include_cell_data=True,
)
with zipfile.ZipFile(output) as archive:
xml = archive.read("GIS.qgs")
self.assertNotIn(config.USER_COUNT_OUTPUT_FILENAME, xml.decode("utf-8"))
names = [item.get("name") for item in ET.fromstring(xml).iter("layer-tree-layer")]
self.assertNotIn("CellData", names)
self.assertIn(Path(config.COMPETITOR_SIGNAL_OUTPUT_FILENAME).stem, names)
self.assertEqual(names[-2:], ["GoogleCN", "必应地图"])
if __name__ == "__main__":