Пример #1
0
    def test_get_directional_vulnerability2(self):
        # thresholds: 11.5, 28.75, 41.25, 90.0

        tower_dic = self.tower_dic.copy()
        tower_dic.update({'axisaz': 0})

        bearings = [
            0., 15., 30., 45., 60., 75., 90., 105., 120., 135., 150., 165.,
            180., 195., 210., 225., 240., 255., 270., 285., 300., 315., 330.,
            345.
        ]
        expected = [
            11.5, 28.75, 41.25, 90.0, 90.0, 90.0, 90.0, 90.0, 90.0, 90.0,
            41.25, 28.75
        ] * 2

        for bearing, value in zip(bearings, expected):

            tower = Tower(**tower_dic)
            result = tower.get_directional_vulnerability(bearing)
            try:
                self.assertAlmostEqual(result, value)
            except AssertionError:
                print(
                    f'Wrong: bearing:{bearing}, axisaz: {tower_dic["axisaz"]}, result:{result}, expected: {value}'
                )
Пример #2
0
    def test_get_directional_vulnerability1(self):
        # thresholds: 11.5, 28.75, 41.25, 90.0

        tower_dic = self.tower_dic.copy()
        tower_dic.update({'axisaz': 90})

        bearings = [
            10.0, 45.0, 60.0, 70.0, 80.0, 170.0, 135.0, 120.0, 110.0, 100.0,
            190.0, 225.0, 240.0, 250.0, 260.0, 350.0, 315.0, 300.0, 290.0,
            280.0
        ]
        expected = [180] * 20

        for bearing, value in zip(bearings, expected):

            tower = Tower(**tower_dic)
            result = tower.get_directional_vulnerability(bearing)
            try:
                self.assertAlmostEqual(result, value)
            except AssertionError:
                print(
                    f'Wrong: bearing:{bearing}, axisaz: {tower_dic["axisaz"]}, result:{result}, expected: {value}'
                )