• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DaveFoss / DAVE_data / 12314379145

13 Dec 2024 10:57AM UTC coverage: 90.133% (+1.1%) from 89.083%
12314379145

push

github

mdaneshfarfh
closes #12, fix tests

52 of 55 branches covered (94.55%)

Branch coverage included in aggregate %.

105 of 128 new or added lines in 2 files covered. (82.03%)

11 existing lines in 2 files now uncovered.

624 of 695 relevant lines covered (89.78%)

3.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.22
/tests/test_hotmaps_request.py
1
import pytest
2✔
2

3
from dave_data.datapool.hotmaps.exception.hotmaps_exceptions import InvalidBbox
2✔
4
from dave_data.datapool.hotmaps.exception.hotmaps_exceptions import InvalidEPSG
2✔
5
from dave_data.datapool.hotmaps.hotmaps_request import hotmaps_request
2✔
6

7

8
def test_valid_request():
2✔
9
    layer_name = "Final energy demand density for space heating and domestic hot water - Total"
2✔
10
    bbox = [
2✔
11
        14.348144531250002,
12
        51.7406361640977,
13
        14.3701171875,
14
        51.754240074033525,
15
    ]
16
    epsg = 4326
2✔
17

18
    try:
2✔
19
        clipped_raster, vector = hotmaps_request(layer_name, bbox, epsg)
2✔
20
        assert clipped_raster is not None, "clipped_raster should not be None"
1✔
21
        assert vector is not None, "vector should not be None"
1✔
22
    except Exception as e:
1✔
23
        pytest.raises(
1✔
24
            Exception, match=f"test_valid_request should not fail: {e}"
25
        )
26

27

28
def test_invalid_bbox():
2✔
29
    layer_name = "Final energy demand density for space heating and domestic hot water - Total"
2✔
30
    bbox = [0, 0, 0]  # Invalid bbox with only three coordinates
2✔
31
    epsg = 4326
2✔
32

33
    try:
2✔
34
        hotmaps_request(layer_name, bbox, epsg)
2✔
NEW
35
        pytest.raises(Exception, match="This should should not be valid")
×
36
    except InvalidBbox:
2✔
37
        assert True
2✔
38
    except Exception as e:
×
NEW
39
        pytest.raises(Exception, match=f"Something went wrong: {e}")
×
40

41

42
def test_invalid_layer_name():
2✔
43
    layer_name = "Invalid Layer Name"
2✔
44
    bbox = [
2✔
45
        14.348144531250002,
46
        51.7406361640977,
47
        14.3701171875,
48
        51.754240074033525,
49
    ]
50
    epsg = 4326
2✔
51

52
    try:
2✔
53
        hotmaps_request(layer_name, bbox, epsg)
2✔
54
        pytest.raises(
2✔
55
            Exception,
56
            match="test_invalid_layer_name failed: Exception expected",
57
        )
NEW
58
    except Exception:
×
NEW
59
        assert True
×
60

61

62
def test_invalid_epsg():
2✔
63
    layer_name = "Final energy demand density for space heating and domestic hot water - Total"
2✔
64
    bbox = [
2✔
65
        14.348144531250002,
66
        51.7406361640977,
67
        14.3701171875,
68
        51.754240074033525,
69
    ]
70
    epsg = 9999  # Assuming 9999 is not a valid EPSG code
2✔
71

72
    try:
2✔
73
        hotmaps_request(layer_name, bbox, epsg)
2✔
NEW
74
        pytest.raises(Exception, match="Should fail on invalid EPSG")
×
75
    except InvalidEPSG:
2✔
76
        assert True
2✔
NEW
77
    except Exception as e:
×
NEW
78
        pytest.raises(Exception, match=f"Something went wrong: {e}")
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc