File size: 974 Bytes
8f604cb
 
 
 
1d46957
8f604cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]

def test_version():
    assert (ROOT/"VERSION").read_text(encoding="utf-8").strip()=="4.6.15"

def test_generic_public_base_not_used():
    py=(ROOT/"services"/"ocean_batch.py").read_text(encoding="utf-8")
    block=py[py.index("self.public_base_url="):py.index("self.concurrency=",py.index("self.public_base_url="))]
    assert "MARINE_PUBLIC_BASE_URL" in block
    assert "os.environ.get(\"PUBLIC_BASE_URL\")" not in block

def test_hf_space_download_rebased_to_marine_service():
    py=(ROOT/"services"/"ocean_batch.py").read_text(encoding="utf-8")
    assert 'host.endswith(".hf.space")' in py
    assert 'parsed.path.startswith("/download/")' in py
    assert "urljoin(self._marine_download_base()" in py

def test_first_export_and_refresh_share_normalizer():
    py=(ROOT/"services"/"ocean_batch.py").read_text(encoding="utf-8")
    assert py.count("self._normalize_export_download_url(result)") >= 2