File size: 1,720 Bytes
3cd8872
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import deploy_check


def test_parse_data_status_detects_dirty_data_paths():
    porcelain = (
        " M data/sections.db\n"
        "M  data/metrics.db\n"
        "?? data/chroma/new-index.bin\n"
    )

    assert deploy_check.parse_data_status(porcelain) == [
        "data/sections.db",
        "data/metrics.db",
        "data/chroma/new-index.bin",
    ]


def test_collect_coverage_flags_unattempted_required_sections(monkeypatch):
    coverage_by_ticker = {
        "AAPL": {
            "status": "PARTIAL",
            "business_sections": 0,
            "business_sections_attempted": 0,
            "segments_geography_sections": 0,
            "segments_geography_sections_attempted": 0,
            "recent_transcripts": 2,
        },
        "NVDA": {
            "status": "COMPLETE",
            "business_sections": 1,
            "business_sections_attempted": 1,
            "segments_geography_sections": 1,
            "segments_geography_sections_attempted": 1,
            "recent_transcripts": 4,
        },
    }
    monkeypatch.setattr(
        deploy_check,
        "profile_source_coverage",
        lambda ticker: coverage_by_ticker[ticker],
    )

    rows, incomplete = deploy_check.collect_coverage(["AAPL", "NVDA"])

    assert incomplete == ["AAPL"]
    assert rows == [
        {
            "ticker": "AAPL",
            "status": "PARTIAL",
            "business_sections": 0,
            "segments_geography_sections": 0,
            "recent_transcripts": 2,
        },
        {
            "ticker": "NVDA",
            "status": "COMPLETE",
            "business_sections": 1,
            "segments_geography_sections": 1,
            "recent_transcripts": 4,
        },
    ]