<gh_stars>0
# Набор тестов для проверки студентами решений по заданию "Практическое задание
# по Beautiful Soup - 2". По умолчанию файл с решением называется solution.py,
# измените в импорте название модуля solution, если файл с решением имеет другое имя.

import unittest

from solution2 import build_bridge, get_statistics

STATISTICS = {
    "Artificial_intelligence": [8, 19, 13, 198],
    "Binyamina_train_station_suicide_bombing": [1, 3, 6, 21],
    "Brain": [19, 5, 25, 11],
    "Haifa_bus_16_suicide_bombing": [1, 4, 15, 23],
    "Hidamari_no_Ki": [1, 5, 5, 35],
    "IBM": [13, 3, 21, 33],
    "Iron_Age": [4, 8, 15, 22],
    "London": [53, 16, 31, 125],
    "Mei_Kurokawa": [1, 1, 2, 7],
    "PlayStation_3": [13, 5, 14, 148],
    "Python_(programming_language)": [2, 5, 17, 41],
    "Second_Intifada": [9, 13, 14, 84],
    "Stone_Age": [13, 10, 12, 40],
    "The_New_York_Times": [5, 9, 8, 42],
    "Wild_Arms_(video_game)": [3, 3, 10, 27],
    "Woolwich": [15, 9, 19, 38],
}

TESTCASES = (
    (
        "wiki/",
        "Stone_Age",
        "Python_(programming_language)",
        [
            "Stone_Age",
            "Brain",
            "Artificial_intelligence",
            "Python_(programming_language)",
        ],
    ),
    (
        "wiki/",
        "The_New_York_Times",
        "Stone_Age",
        ["The_New_York_Times", "London", "Woolwich", "Iron_Age", "Stone_Age"],
    ),
    (
        "wiki/",
        "Artificial_intelligence",
        "Mei_Kurokawa",
        [
            "Artificial_intelligence",
            "IBM",
            "PlayStation_3",
            "Wild_Arms_(video_game)",
            "Hidamari_no_Ki",
            "Mei_Kurokawa",
        ],
    ),
    (
        "wiki/",
        "The_New_York_Times",
        "Binyamina_train_station_suicide_bombing",
        [
            "The_New_York_Times",
            "Second_Intifada",
            "Haifa_bus_16_suicide_bombing",
            "Binyamina_train_station_suicide_bombing",
        ],
    ),
    (
        "wiki/",
        "Stone_Age",
        "Stone_Age",
        [
            "Stone_Age",
        ],
    ),
)


class TestBuildBrige(unittest.TestCase):
    def test_build_bridge(self):
        for path, start_page, end_page, expected in TESTCASES:
            with self.subTest(
                path=path, start_page=start_page, end_page=end_page, expected=expected
            ):
                result = build_bridge(path, start_page, end_page)
                self.assertEqual(result, expected)


class TestGetStatistics(unittest.TestCase):
    def test_build_bridge(self):
        for path, start_page, end_page, expected in TESTCASES:
            with self.subTest(
                path=path, start_page=start_page, end_page=end_page, expected=expected
            ):
                result = get_statistics(path, start_page, end_page)
                self.assertEqual(result, {page: STATISTICS[page] for page in expected})


if __name__ == "__main__":
    unittest.main()

# Набор тестов для проверки студентами решений по заданию "Практическое задание
# по Beautiful Soup - 2". По умолчанию файл с решением называется solution.py,
# измените в импорте название модуля solution, если файл с решением имеет другое имя.

import unittest

from solution2 import build_bridge, get_statistics

STATISTICS = {
    "Artificial_intelligence": [8, 19, 13, 198],
    "Binyamina_train_station_suicide_bombing": [1, 3, 6, 21],
    "Brain": [19, 5, 25, 11],
    "Haifa_bus_16_suicide_bombing": [1, 4, 15, 23],
    "Hidamari_no_Ki": [1, 5, 5, 35],
    "IBM": [13, 3, 21, 33],
    "Iron_Age": [4, 8, 15, 22],
    "London": [53, 16, 31, 125],
    "Mei_Kurokawa": [1, 1, 2, 7],
    "PlayStation_3": [13, 5, 14, 148],
    "Python_(programming_language)": [2, 5, 17, 41],
    "Second_Intifada": [9, 13, 14, 84],
    "Stone_Age": [13, 10, 12, 40],
    "The_New_York_Times": [5, 9, 8, 42],
    "Wild_Arms_(video_game)": [3, 3, 10, 27],
    "Woolwich": [15, 9, 19, 38],
}

TESTCASES = (
    (
        "wiki/",
        "Stone_Age",
        "Python_(programming_language)",
        [
            "Stone_Age",
            "Brain",
            "Artificial_intelligence",
            "Python_(programming_language)",
        ],
    ),
    (
        "wiki/",
        "The_New_York_Times",
        "Stone_Age",
        ["The_New_York_Times", "London", "Woolwich", "Iron_Age", "Stone_Age"],
    ),
    (
        "wiki/",
        "Artificial_intelligence",
        "Mei_Kurokawa",
        [
            "Artificial_intelligence",
            "IBM",
            "PlayStation_3",
            "Wild_Arms_(video_game)",
            "Hidamari_no_Ki",
            "Mei_Kurokawa",
        ],
    ),
    (
        "wiki/",
        "The_New_York_Times",
        "Binyamina_train_station_suicide_bombing",
        [
            "The_New_York_Times",
            "Second_Intifada",
            "Haifa_bus_16_suicide_bombing",
            "Binyamina_train_station_suicide_bombing",
        ],
    ),
    (
        "wiki/",
        "Stone_Age",
        "Stone_Age",
        [
            "Stone_Age",
        ],
    ),
)


class TestBuildBrige(unittest.TestCase):
    def test_build_bridge(self):
        for path, start_page, end_page, expected in TESTCASES:
            with self.subTest(
                path=path, start_page=start_page, end_page=end_page, expected=expected
            ):
                result = build_bridge(path, start_page, end_page)
                self.assertEqual(result, expected)


class TestGetStatistics(unittest.TestCase):
    def test_build_bridge(self):
        for path, start_page, end_page, expected in TESTCASES:
            with self.subTest(
                path=path, start_page=start_page, end_page=end_page, expected=expected
            ):
                result = get_statistics(path, start_page, end_page)
                self.assertEqual(result, {page: STATISTICS[page] for page in expected})


if __name__ == "__main__":
    unittest.main()
# Набор тестов для проверки студентами решений по заданию "Практическое задание # по Beautiful Soup - 2". По умолчанию файл с решением называется solution.py, # измените в импорте название модуля solution, если файл с решением имеет другое имя.