def test_build_heatmap_basic():
    entries1 = [(2, 'a'), (6, 'b')]
    exits1 = [(4, 'a'), (8, 'b')]
    m1 = initialise_user_movements(1, entries1, exits1)

    entries2 = [(1, 'b')]
    exits2 = [(9, 'b')]
    m2 = initialise_user_movements(2, entries2, exits2)

    heatmap_gen = HeatmapGenerator(1, merge_user_movements(m1, m2))

    expected_at_2 = {'a': 1, 'b': 1}
    expected_at_10 = {}
    assert expected_at_2 == heatmap_gen.build_heat_map(2)
    assert expected_at_10 == heatmap_gen.build_heat_map(10)
def test_build_heatmap_no_exit():
    entries1 = [(2, 'a'), (4, 'b')]
    exits1 = [(6, 'a')]
    m1 = initialise_user_movements(1, entries1, exits1)
    heatmap_gen = HeatmapGenerator(1, m1)

    assert heatmap_gen.build_heat_map(100) == {'b': 1}
def test_build_heatmap_advanced():
    entries1 = [(2, 'a'), (4, 'b')]
    exits1 = [(6, 'a'), (8, 'b')]
    m1 = initialise_user_movements(1, entries1, exits1)

    entries2 = [(1, 'b')]
    exits2 = [(19, 'b')]
    m2 = initialise_user_movements(2, entries2, exits2)

    entries3 = [(1, 'a'), (3, 'a')]
    exits3 = [(2, 'a'), (7, 'a')]
    m3 = initialise_user_movements(3, entries3, exits3)

    heatmap_gen = HeatmapGenerator(1, merge_user_movements(m1, m2, m3))

    expected_at_5 = {'a': 1, 'b': 2}
    expected_at_19 = {}
    assert expected_at_5 == heatmap_gen.build_heat_map(5)
    assert expected_at_19 == heatmap_gen.build_heat_map(19)