Ejemplo n.º 1
0
 def test1(self):
     site_list = ["a.com", "b.com", "a.com", "b.com", "a.com", "c.com"]
     user_list = ["andy", "andy", "bob", "bob", "charlie", "charlie"]
     time_list = [1238972321, 1238972456, 1238972618, 1238972899, 1248472489, 1258861829]
     computed_result = compute_highest_affinity.highest_affinity(site_list, user_list, time_list)
     expected_result = ("a.com", "b.com")
     self.assertEqual(computed_result, expected_result)
Ejemplo n.º 2
0
    def test4(self):
        a = "a"
        b = "b"
        c = "c"
        d = "d"
        e = "e"
        f = "f"
        g = "g"
        h = "h"

        A = "A"
        B = "B"
        C = "C"
        D = "D"
        E = "E"
        F = "F"
        G = "G"
        H = "H"
        site_list = [a, a, a, a, b, b, b, b, c, c, c, d, d, d, d, d]
        user_list = [B, D, E, F, A, B, C, F, B, D, E, A, B, C, D, F]
        time_list = range(0, 16)

        computed_result = compute_highest_affinity.highest_affinity(
            site_list, user_list, time_list)
        expected_result = (b, d)
        self.assertEqual(computed_result, expected_result)
Ejemplo n.º 3
0
    def test(self):

        site_list = ["a.com", "b.com", "a.com", "b.com", "a.com", "c.com"]
        user_list = ["andy", "andy", "bob", "bob", "charlie", "charlie"]
        time_list = [
            1238972321, 1238972456, 1238972618, 1238972899, 1248472489,
            1258861829
        ]

        computed_result = compute_highest_affinity.highest_affinity(
            site_list, user_list, time_list)
        expected_result = ("a.com", "b.com")

        assert computed_result == expected_result
        print("Successfully passed {}!".format(
            os.path.basename(__file__).split(".")[0]))
Ejemplo n.º 4
0
g = "g"
h = "h"

A = "A"
B = "B"
C = "C"
D = "D"
E = "E"
F = "F"
G = "G"
H = "H"

user_list = [
    A, C, H, A, C, D, E, F, G, C, D, E, F, G, H, C, B, D, E, F, G, C, G, A, D,
    E, H, A, C, E, H
]
site_list = [
    a, a, a, b, b, b, b, b, b, c, c, c, c, c, c, d, e, e, e, e, e, f, f, g, g,
    g, g, h, h, h, h
]

time_list = range(0, 31)

computed_result = compute_highest_affinity.highest_affinity(
    site_list, user_list, time_list)
expected_result = (b, c)

assert computed_result == expected_result
print("Successfully passed {}!".format(
    os.path.basename(__file__).split(".")[0]))