21 lines
754 B
Python
21 lines
754 B
Python
|
|
"""D2:铝价数据必须显式声明模拟来源。
|
||
|
|
|
||
|
|
数据为模拟走势(aluminum_price_service 模块 docstring 自述),
|
||
|
|
此前接口不声明来源、前端硬编码"数据来源: 上海期货交易所",属虚假来源声明。
|
||
|
|
"""
|
||
|
|
|
||
|
|
|
||
|
|
def test_current_price_declares_simulated_source():
|
||
|
|
from moldinsight.services.aluminum_price_service import get_aluminum_current_price
|
||
|
|
|
||
|
|
data = get_aluminum_current_price()
|
||
|
|
assert data["source"] == "simulated"
|
||
|
|
|
||
|
|
|
||
|
|
def test_history_items_declare_simulated_source():
|
||
|
|
from moldinsight.services.aluminum_price_service import get_aluminum_price_history
|
||
|
|
|
||
|
|
history = get_aluminum_price_history(days=30)
|
||
|
|
assert len(history) > 0
|
||
|
|
assert all(item["source"] == "simulated" for item in history)
|