new tasks, model pricing, auto quantisation, etc...
This commit is contained in:
@@ -148,3 +148,41 @@ def test_hf_pricing_log_persists_and_is_queryable(tmp_path):
|
||||
# Reopening against the same db path recovers the log (billing.py pattern).
|
||||
reopened = HfPricingLog(db_path=db_path)
|
||||
assert len(reopened.history()) == 1
|
||||
|
||||
|
||||
def test_preset_price_keys_cover_name_repo_and_aliases():
|
||||
from meshnet_tracker.server import _preset_price_keys
|
||||
|
||||
preset = {
|
||||
"hf_repo": "unsloth/Qwen3.6-35B-A3B",
|
||||
"aliases": ["qwen3.6-35b-a3b", "Qwen/Qwen3.6-35B-A3B"],
|
||||
}
|
||||
keys = _preset_price_keys("qwen3.6-35b-a3b", preset)
|
||||
assert keys == {
|
||||
"qwen3.6-35b-a3b",
|
||||
"unsloth/Qwen3.6-35B-A3B",
|
||||
"Qwen/Qwen3.6-35B-A3B",
|
||||
}
|
||||
assert _preset_price_keys("bare", {}) == {"bare"}
|
||||
|
||||
|
||||
def test_qwen_preset_prices_apply_to_all_aliases(tmp_path):
|
||||
"""Requests naming the repo id (what nodes register) bill at the preset price."""
|
||||
from meshnet_tracker.server import TrackerServer
|
||||
|
||||
import pytest
|
||||
|
||||
tracker = TrackerServer(billing_db=str(tmp_path / "billing.sqlite"))
|
||||
try:
|
||||
billing = tracker._billing
|
||||
assert billing is not None
|
||||
for key in (
|
||||
"qwen3.6-35b-a3b",
|
||||
"unsloth/Qwen3.6-35B-A3B",
|
||||
"Qwen/Qwen3.6-35B-A3B",
|
||||
):
|
||||
assert billing.price_for(key) == pytest.approx(0.00044), key
|
||||
# Unknown models keep the default rate
|
||||
assert billing.price_for("some/other-model") == pytest.approx(0.02)
|
||||
finally:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user