# Path: app/services/temperature_map.py
# def calculate_color(value, interval_length):
#     assert interval_length >= 0
#     
#     if interval_length == 0:
#         return rgb_to_hex(1, 0, 0)
#     
#     hue = 240 - 240 * value / interval_length
#     return rgb_to_hex(*hsv_to_rgb(hue / 360, 1, 1))


from random import randint
from app.services.temperature_map import calculate_color



def test_red():
    interval = randint(1, 1000)
    value = interval
    
    color = calculate_color(value, interval)
    
    assert color == "#ff0000"


def test_yellow():
    interval = randint(1, 1000) * 4
    value = interval * 3 / 4
    
    color = calculate_color(value, interval)
    
    assert color == "#ffff00"


def test_green():
    value = randint(1, 1000)
    interval = value * 2
    

# Path: app/services/temperature_map.py
# def calculate_color(value, interval_length):
#     assert interval_length >= 0
#     
#     if interval_length == 0:
#         return rgb_to_hex(1, 0, 0)
#     
#     hue = 240 - 240 * value / interval_length
#     return rgb_to_hex(*hsv_to_rgb(hue / 360, 1, 1))


# Path: tests/temperature_map_test.py
from random import randint
from app.services.temperature_map import calculate_color




def test_red():
    interval = randint(1, 1000)
    value = interval
    
    color = calculate_color(value, interval)
    
    assert color == "#ff0000"


def test_yellow():
    interval = randint(1, 1000) * 4
    value = interval * 3 / 4
    
    color = calculate_color(value, interval)
    
    assert color == "#ffff00"


def test_green():
    value = randint(1, 1000)
    interval = value * 2
    

    color = calculate_color(value, interval)