def test_target_cover(self):
        """
        Test ``cover`` target type parser.
        """
        lines = [
            "5 1 1 20 250 132865 87291 0 1 1_Chief 132866 86905",
        ]

        expected = {
            'targets': [
                {
                    'type': TargetTypes.cover,
                    'priority': TargetPriorities.secondary,
                    'in_sleep_mode': True,
                    'delay': 20,
                    'destruction_level': 25,
                    'pos': Point2D(132865.0, 87291.0),
                    'object': {
                        'waypoint': 1,
                        'id': '1_Chief',
                        'pos': Point2D(132866.0, 86905.0),
                    },
                },
            ],
        }
        self.assertParser(TargetSectionParser, 'Target', lines, expected)
Ejemplo n.º 2
0
 def test_valid_data(self):
     lines = [
         "0_Rocket Fi103_V1_ramp 2 84141.38 114216.82 360.00 60.0 10 80.0 83433.91 115445.49",
         "1_Rocket Fi103_V1_ramp 2 84141.38 114216.82 360.00 60.0 10 80.0",
     ]
     expected = {
         'rockets': [
             Rocket(
                 id='0_Rocket',
                 code='Fi103_V1_ramp',
                 belligerent=Belligerents.blue,
                 pos=Point2D(84141.38, 114216.82),
                 rotation_angle=0.00,
                 delay=60.0,
                 count=10,
                 period=80.0,
                 destination=Point2D(83433.91, 115445.49),
             ),
             Rocket(
                 id='1_Rocket',
                 code='Fi103_V1_ramp',
                 belligerent=Belligerents.blue,
                 pos=Point2D(84141.38, 114216.82),
                 rotation_angle=0.00,
                 delay=60.0,
                 count=10,
                 period=80.0,
                 destination=None,
             ),
         ],
     }
     self.assertParser(RocketSectionParser, 'Rocket', lines, expected)
    def test_target_escort(self):
        """
        Test ``escort`` target type parser.
        """
        lines = [
            "4 0 1 10 750 134183 85468 0 1 r0100 133993 85287",
        ]

        expected = {
            'targets': [
                {
                    'type': TargetTypes.escort,
                    'priority': TargetPriorities.primary,
                    'in_sleep_mode': True,
                    'delay': 10,
                    'destruction_level': 75,
                    'pos': Point2D(134183.0, 85468.0),
                    'object': {
                        'waypoint': 1,
                        'id': 'r0100',
                        'pos': Point2D(133993.0, 85287.0),
                    },
                },
            ],
        }
        self.assertParser(TargetSectionParser, 'Target', lines, expected)
    def test_target_destroy(self):
        """
        Test ``destroy`` target type parser.
        """
        lines = [
            "0 0 0 0 500 90939 91871 0 1 10_Chief 91100 91500",
        ]

        expected = {
            'targets': [
                {
                    'type': TargetTypes.destroy,
                    'priority': TargetPriorities.primary,
                    'in_sleep_mode': False,
                    'delay': 0,
                    'destruction_level': 50,
                    'pos': Point2D(90939.0, 91871.0),
                    'object': {
                        'waypoint': 1,
                        'id': '10_Chief',
                        'pos': Point2D(91100.0, 91500.0),
                    },
                },
            ],
        }
        self.assertParser(TargetSectionParser, 'Target', lines, expected)
Ejemplo n.º 5
0
 def parse_destroy_or_cover_bridge(params):
     """
     Parse extra parameters for targets with type 'destroy bridge' or
     'cover bridge'.
     """
     pos, object_code, object_pos = params[1:3], params[5], params[6:8]
     return {
         'pos': Point2D(*pos),
         'object': {
             'id': object_code,
             'pos': Point2D(*object_pos),
         },
     }
Ejemplo n.º 6
0
    def test_valid_data(self):
        data = dict(
            id='0_Rocket',
            code='Fi103_V1_ramp',
            belligerent=Belligerents.blue,
            pos=Point2D(84141.38, 114216.82),
            rotation_angle=360.00,
            delay=60.0,
            count=10,
            period=80.0,
            destination=Point2D(83433.91, 115445.49),
        )
        self.assertStructure(Rocket, **data)

        instance = Rocket(**data)
        self.assertEqual(repr(instance), "<Rocket '0_Rocket'>")
Ejemplo n.º 7
0
 def parse_destroy_or_cover_or_escort(params):
     """
     Parse extra parameters for targets with type 'destroy' or 'cover' or
     'escort'.
     """
     destruction_level = to_destruction_level(params[0])
     pos, waypoint, object_code = params[1:3], params[4], params[5]
     object_pos = params[6:8]
     return {
         'destruction_level': destruction_level,
         'pos': Point2D(*pos),
         'object': {
             'waypoint': int(waypoint),
             'id': object_code,
             'pos': Point2D(*object_pos),
         },
     }
Ejemplo n.º 8
0
    def parse_line(self, line):
        params = line.split()

        oid, code, belligerent = params[0:3]
        pos = params[3:5]
        rotation_angle, delay, count, period = params[5:9]
        destination = params[9:]

        self.data.append(
            Rocket(id=oid,
                   code=code,
                   belligerent=to_belligerent(belligerent),
                   pos=Point2D(*pos),
                   rotation_angle=to_angle(rotation_angle),
                   delay=float(delay),
                   count=int(count),
                   period=float(period),
                   destination=Point2D(*destination) if destination else None))
Ejemplo n.º 9
0
 def test_valid_data(self):
     lines = [
         "21380.02 41700.34 120.00 10 3 3.055555582046509",
         "21500.00 41700.00 120.00",
         "50299.58 35699.85 120.00 0 3 2.6388890743255615",
         "60284.10 59142.93 120.00",
         "84682.13 98423.69 120.00",
     ]
     expected = {
         'route_0_Chief': [
             GroundRoutePoint(
                 pos=Point2D(21380.02, 41700.34),
                 is_checkpoint=True,
                 delay=10,
                 section_length=3,
                 speed=11.0,
             ),
             GroundRoutePoint(
                 pos=Point2D(21500.00, 41700.00),
                 is_checkpoint=False,
             ),
             GroundRoutePoint(
                 pos=Point2D(50299.58, 35699.85),
                 is_checkpoint=True,
                 delay=0,
                 section_length=3,
                 speed=9.5,
             ),
             GroundRoutePoint(
                 pos=Point2D(60284.10, 59142.93),
                 is_checkpoint=False,
             ),
             GroundRoutePoint(
                 pos=Point2D(84682.13, 98423.69),
                 is_checkpoint=False,
             ),
         ],
     }
     self.assertParser(
         ChiefRoadSectionParser,
         '0_Chief_Road',
         lines,
         expected,
     )
Ejemplo n.º 10
0
 def parse_recon(params):
     """
     Parse extra parameters for targets with 'recon' type.
     """
     requires_landing = params[0] != '500'
     pos, radius, params = params[1:3], params[3], params[4:]
     data = {
         'radius': int(radius),
         'requires_landing': requires_landing,
         'pos': Point2D(*pos),
     }
     if params:
         waypoint, object_code = params[:2]
         object_pos = params[2:]
         data['object'] = {
             'waypoint': int(waypoint),
             'id': object_code,
             'pos': Point2D(*object_pos),
         }
     return data
Ejemplo n.º 11
0
 def parse_destroy_or_cover_area(params):
     """
     Parse extra parameters for targets with type 'destroy area' or
     'cover area'.
     """
     destruction_level = to_destruction_level(params[0])
     pos_x, pos_y, radius = params[1:]
     return {
         'destruction_level': destruction_level,
         'pos': Point2D(pos_x, pos_y),
         'radius': int(radius),
     }
Ejemplo n.º 12
0
    def test_valid_data(self):
        data = dict(
            id='0_bld',
            belligerent=Belligerents.red,
            code='Tent_Pyramid_US',
            pos=Point2D(43471.34, 57962.08),
            rotation_angle=630.00,
        )
        self.assertStructure(Building, **data)

        instance = Building(**data)
        self.assertEqual(repr(instance), "<Building '0_bld'>")
Ejemplo n.º 13
0
    def test_valid_data(self):
        data = dict(
            belligerent=Belligerents.none,
            id='6_Static',
            code='Smoke20',
            pos=Point2D(151404.61, 89009.57),
            rotation_angle=360.00,
            type=UnitTypes.stationary,
        )
        self.assertStructure(StationaryObject, **data)

        instance = StationaryObject(**data)
        self.assertEqual(repr(instance), "<StationaryObject '6_Static'>")
Ejemplo n.º 14
0
 def parse_line(self, line):
     params = line.split()
     oid, building_object, belligerent = params[:3]
     pos_x, pos_y, rotation_angle = params[3:]
     code = building_object.split('$')[1]
     self.data.append(
         Building(
             id=oid,
             belligerent=to_belligerent(belligerent),
             code=code,
             pos=Point2D(pos_x, pos_y),
             rotation_angle=to_angle(rotation_angle),
         ))
Ejemplo n.º 15
0
    def parse_line(self, line):
        (
            belligerent, the_range, pos_x, pos_y, has_parachutes,
            air_spawn_height, air_spawn_speed, air_spawn_heading, max_pilots,
            radar_min_height, radar_max_height, radar_range, air_spawn_always,
            enable_aircraft_limits, aircraft_limits_consider_lost,
            disable_spawning, friction_enabled, friction_value,
            aircraft_limits_consider_stationary, show_default_icon,
            air_spawn_if_deck_is_full, spawn_in_stationary,
            return_to_start_position
        ) = line.split()

        self.data.append({
            'range': int(the_range),
            'belligerent': to_belligerent(belligerent),
            'show_default_icon': to_bool(show_default_icon),
            'friction': {
                'enabled': to_bool(friction_enabled),
                'value': float(friction_value),
            },
            'spawning': {
                'enabled': not to_bool(disable_spawning),
                'with_parachutes': to_bool(has_parachutes),
                'max_pilots': int(max_pilots),
                'in_stationary': {
                    'enabled': to_bool(spawn_in_stationary),
                    'return_to_start_position': to_bool(return_to_start_position),
                },
                'in_air': {
                    'height': int(air_spawn_height),
                    'speed': int(air_spawn_speed),
                    'heading': int(air_spawn_heading),
                    'conditions': {
                        'always': to_bool(air_spawn_always),
                        'if_deck_is_full': to_bool(air_spawn_if_deck_is_full),
                    },
                },
                'aircraft_limitations': {
                    'enabled': to_bool(enable_aircraft_limits),
                    'consider_lost': to_bool(aircraft_limits_consider_lost),
                    'consider_stationary': to_bool(aircraft_limits_consider_stationary),
                },
            },
            'radar': {
                'range': int(radar_range),
                'min_height': int(radar_min_height),
                'max_height': int(radar_max_height),
            },
            'pos': Point2D(pos_x, pos_y),
        })
    def test_target_recon(self):
        """
        Test ``recon`` target type parser.
        """
        lines = [
            "3 1 1 50 500 133978 87574 1150",
            "3 0 1 40 501 134459 85239 300 0 1_Chief 134360 85346",
        ]

        expected = {
            'targets': [
                {
                    'type': TargetTypes.recon,
                    'priority': TargetPriorities.secondary,
                    'in_sleep_mode': True,
                    'delay': 50,
                    'requires_landing': False,
                    'pos': Point2D(133978.0, 87574.0),
                    'radius': 1150,
                },
                {
                    'type': TargetTypes.recon,
                    'priority': TargetPriorities.primary,
                    'in_sleep_mode': True,
                    'delay': 40,
                    'requires_landing': True,
                    'pos': Point2D(134459.0, 85239.0),
                    'radius': 300,
                    'object': {
                        'waypoint': 0,
                        'id': '1_Chief',
                        'pos': Point2D(134360.0, 85346.0),
                    },
                },
            ],
        }
        self.assertParser(TargetSectionParser, 'Target', lines, expected)
    def test_target_destroy_bridge(self):
        """
        Test 'destroy bridge' target type parser.
        """
        lines = [
            "2 2 1 30 500 135786 84596 0 0  Bridge84 135764 84636",
        ]

        expected = {
            'targets': [
                {
                    'type': TargetTypes.destroy_bridge,
                    'priority': TargetPriorities.hidden,
                    'in_sleep_mode': True,
                    'delay': 30,
                    'pos': Point2D(135786.0, 84596.0),
                    'object': {
                        'id': 'Bridge84',
                        'pos': Point2D(135764.0, 84636.0),
                    },
                },
            ],
        }
        self.assertParser(TargetSectionParser, 'Target', lines, expected)
Ejemplo n.º 18
0
    def test_valid_data(self):
        data = dict(
            pos=Point2D(21380.02, 41700.34),
            is_checkpoint=True,
            section_length=3,
            speed=3.055555582046509,
            delay=10,
        )
        self.assertStructure(GroundRoutePoint, **data)

        instance = GroundRoutePoint(**data)
        self.assertEqual(
            repr(instance),
            "<GroundRoutePoint '21380.02;41700.34'>",
        )
Ejemplo n.º 19
0
 def test_valid_data(self):
     lines = [
         "0_bld House$Tent_Pyramid_US 1 43471.34 57962.08 630.00",
     ]
     expected = {
         'buildings': [
             Building(
                 id='0_bld',
                 belligerent=Belligerents.red,
                 code='Tent_Pyramid_US',
                 pos=Point2D(43471.34, 57962.08),
                 rotation_angle=270.00,
             ),
         ],
     }
     self.assertParser(BuildingsSectionParser, 'Buildings', lines, expected)
Ejemplo n.º 20
0
    def test_valid_data(self):
        data = dict(
            belligerent=Belligerents.red,
            id='9_Static',
            code='G5',
            recharge_time=1.4,
            pos=Point2D(83759.05, 115021.15),
            rotation_angle=360.00,
            skill=Skills.ace,
            type=UnitTypes.ship,
            awakening_time=60.0,
        )
        self.assertStructure(StationaryShip, **data)

        instance = StationaryShip(**data)
        self.assertEqual(repr(instance), "<StationaryShip '9_Static'>")
 def test_valid_data(self):
     lines = [
         "1 3000 121601 74883 1 1000 200 0 0 0 5000 50 0 1 1 0 0 3.8 1 0 0 0 0",
     ]
     expected = {
         'home_bases': [
             {
                 'range': 3000,
                 'belligerent': Belligerents.red,
                 'show_default_icon': False,
                 'friction': {
                     'enabled': False,
                     'value': 3.8,
                 },
                 'spawning': {
                     'enabled': True,
                     'with_parachutes': True,
                     'max_pilots': 0,
                     'in_stationary': {
                         'enabled': False,
                         'return_to_start_position': False,
                     },
                     'in_air': {
                         'height': 1000,
                         'speed': 200,
                         'heading': 0,
                         'conditions': {
                             'always': False,
                             'if_deck_is_full': False,
                         },
                     },
                     'aircraft_limitations': {
                         'enabled': True,
                         'consider_lost': True,
                         'consider_stationary': True,
                     },
                 },
                 'radar': {
                     'range': 50,
                     'min_height': 0,
                     'max_height': 5000,
                 },
                 'pos': Point2D(121601.0, 74883.0),
             },
         ]
     }
     self.assertParser(BornPlaceSectionParser, 'BornPlace', lines, expected)
Ejemplo n.º 22
0
    def test_valid_data(self):
        data = dict(
            id='1_Static',
            belligerent=Belligerents.blue,
            code='SdKfz251',
            pos=Point2D(31333.62, 90757.91),
            rotation_angle=600.29,
            type=UnitTypes.artillery,
            range=0,
            skill=Skills.average,
            use_spotter=True,
            awakening_time=0.0,
        )
        self.assertStructure(StationaryArtillery, **data)

        instance = StationaryArtillery(**data)
        self.assertEqual(repr(instance), "<StationaryArtillery '1_Static'>")
Ejemplo n.º 23
0
    def test_valid_data(self):
        data = dict(
            id='3_Static',
            code='I_16TYPE24',
            belligerent=Belligerents.red,
            pos=Point2D(134146.89, 88005.43),
            rotation_angle=336.92,
            type=UnitTypes.aircraft,
            air_force=AirForces.vvs_rkka,
            allows_spawning=True,
            show_markings=True,
            is_restorable=True,
            skin="I-16type24_G1_RoW3.bmp",
        )
        self.assertStructure(StationaryAircraft, **data)

        instance = StationaryAircraft(**data)
        self.assertEqual(repr(instance), "<StationaryAircraft '3_Static'>")
Ejemplo n.º 24
0
    def parse_line(self, line):
        params = line.split()
        pos, params = params[0:2], params[3:]

        args = {
            'pos': Point2D(*pos),
        }

        is_checkpoint = bool(params)
        args['is_checkpoint'] = is_checkpoint

        if is_checkpoint:
            args['delay'] = int(params[0])
            args['section_length'] = int(params[1])
            args['speed'] = to_speed(params[2])

        point = GroundRoutePoint(**args)
        self.data.append(point)
    def test_target_destroy_area(self):
        """
        Test 'destroy area' target type parser.
        """
        lines = [
            "1 1 1 60 750 133960 87552 1350",
        ]

        expected = {
            'targets': [
                {
                    'type': TargetTypes.destroy_area,
                    'priority': TargetPriorities.secondary,
                    'in_sleep_mode': True,
                    'delay': 60,
                    'destruction_level': 75,
                    'pos': Point2D(133960.0, 87552.0),
                    'radius': 1350,
                },
            ],
        }
        self.assertParser(TargetSectionParser, 'Target', lines, expected)
    def test_target_cover_area(self):
        """
        Test 'cover area' target type parser.
        """
        lines = [
            "6 1 1 30 500 134064 88188 1350",
        ]

        expected = {
            'targets': [
                {
                    'type': TargetTypes.cover_area,
                    'priority': TargetPriorities.secondary,
                    'in_sleep_mode': True,
                    'delay': 30,
                    'destruction_level': 50,
                    'pos': Point2D(134064.0, 88188.0),
                    'radius': 1350,
                },
            ],
        }
        self.assertParser(TargetSectionParser, 'Target', lines, expected)
    def parse_line(self, line):
        params = line.split()

        oid, object_name, belligerent = params[0], params[1], params[2]
        pos = params[3:5]
        rotation_angle = params[5]
        params = params[6:]

        unit_type = self._get_type(object_name)
        info = {
            'id': oid,
            'belligerent': to_belligerent(belligerent),
            'code': self._get_code(object_name),
            'pos': Point2D(*pos),
            'rotation_angle': to_angle(rotation_angle),
            'type': unit_type,
        }

        subparser = self.__subparsers.get(unit_type)
        if subparser:
            info.update(subparser(params))

        structure_class = structure_class_by_unit_type(unit_type)
        self.data.append(structure_class(**info))
Ejemplo n.º 28
0
 def test_valid_data(self):
     lines = [
         "0_Static vehicles.aeronautics.Aeronautics$BarrageBalloon_2400m 1 151781.85 89055.58 360.00 0.0",
         "1_Static vehicles.artillery.Artillery$SdKfz251 2 31333.62 90757.91 600.29 0.0 0 1 1",
         "57_Static vehicles.artillery.Artillery$Flak18_37mm 2 153849.64 163928.12 360.00 0.0 0",
         "58_Static vehicles.artillery.Artillery$Flak18_88mm 2 87591.03 115255.62 690.00 0.0",
         "2_Static vehicles.lights.Searchlight$SL_ManualBlue 1 151740.45 88673.74 360.00 0.0",
         "3_Static vehicles.planes.Plane$I_16TYPE24 1 134146.89 88005.43 336.92 0.0 null 2 1.0 I-16type24_G1_RoW3.bmp 1",
         "458_Static vehicles.planes.Plane$FW_190A4FR 2 33201.34 73105.78 265.00 0.0 de 1 1.0 null 0",
         "459_Static vehicles.planes.Plane$A_20C 0 30663.31 24632.09 360.00 0.0 nn 1 1.0 null 0",
         "19_Static vehicles.planes.Plane$JU_87D3 2 153811.08 164330.47 360.00 0.0 null 1",
         "4_Static vehicles.radios.Beacon$RadioBeacon 2 151679.84 88805.39 360.00 0.0",
         "5_Static vehicles.stationary.Campfire$CampfireAirfield 0 151428.38 88817.52 360.00 0.0",
         "6_Static vehicles.stationary.Smoke$Smoke20 0 151404.61 89009.57 360.00 0.00",
         "7_Static vehicles.stationary.Siren$SirenCity 1 151984.28 88577.12 360.00 0.0",
         "8_Static vehicles.stationary.Stationary$Wagon1 1 152292.72 89662.80 360.00 0.0",
         "9_Static ships.Ship$G5 1 83759.05 115021.15 360.00 0.0 60 3 1.4",
         "10_Static FAKE.SomethingUnknown.FAKE$XXX 1 152292.72 89662.80 360.00 0.0",
     ]
     expected = {
         'stationary': [
             StationaryObject(
                 id='0_Static',
                 belligerent=Belligerents.red,
                 code='BarrageBalloon_2400m',
                 pos=Point2D(151781.85, 89055.58),
                 rotation_angle=0.00,
                 type=UnitTypes.balloon,
             ),
             StationaryArtillery(
                 id='1_Static',
                 belligerent=Belligerents.blue,
                 code='SdKfz251',
                 pos=Point2D(31333.62, 90757.91),
                 rotation_angle=240.29,
                 type=UnitTypes.artillery,
                 awakening_time=0.0,
                 range=0,
                 skill=Skills.average,
                 use_spotter=True,
             ),
             StationaryArtillery(
                 id='57_Static',
                 belligerent=Belligerents.blue,
                 code='Flak18_37mm',
                 pos=Point2D(153849.64, 163928.12),
                 rotation_angle=0.0,
                 type=UnitTypes.artillery,
                 awakening_time=0.0,
                 range=0,
                 skill=None,
                 use_spotter=False,
             ),
             StationaryArtillery(
                 id='58_Static',
                 belligerent=Belligerents.blue,
                 code='Flak18_88mm',
                 pos=Point2D(87591.03, 115255.62),
                 rotation_angle=330.00,
                 type=UnitTypes.artillery,
                 awakening_time=0.0,
                 range=0,
                 skill=None,
                 use_spotter=False,
             ),
             StationaryObject(
                 id='2_Static',
                 code='SL_ManualBlue',
                 belligerent=Belligerents.red,
                 pos=Point2D(151740.45, 88673.74),
                 rotation_angle=0.00,
                 type=UnitTypes.light,
             ),
             StationaryAircraft(
                 id='3_Static',
                 code='I_16TYPE24',
                 belligerent=Belligerents.red,
                 pos=Point2D(134146.89, 88005.43),
                 rotation_angle=336.92,
                 type=UnitTypes.aircraft,
                 air_force=AirForces.vvs_rkka,
                 allows_spawning=True,
                 show_markings=True,
                 is_restorable=True,
                 skin="I-16type24_G1_RoW3.bmp",
             ),
             StationaryAircraft(
                 air_force=AirForces.luftwaffe,
                 allows_spawning=True,
                 belligerent=Belligerents.blue,
                 id='458_Static',
                 code='FW_190A4FR',
                 show_markings=False,
                 pos=Point2D(33201.34, 73105.78),
                 rotation_angle=265.0,
                 is_restorable=False,
                 skin=None,
                 type=UnitTypes.aircraft,
             ),
             StationaryAircraft(
                 air_force=AirForces.none,
                 allows_spawning=True,
                 belligerent=Belligerents.none,
                 id='459_Static',
                 code='A_20C',
                 show_markings=False,
                 pos=Point2D(30663.31, 24632.09),
                 rotation_angle=0.0,
                 is_restorable=False,
                 skin=None,
                 type=UnitTypes.aircraft,
             ),
             StationaryAircraft(
                 air_force=None,
                 allows_spawning=False,
                 belligerent=Belligerents.blue,
                 id='19_Static',
                 code='JU_87D3',
                 show_markings=True,
                 pos=Point2D(153811.08, 164330.47),
                 rotation_angle=0.0,
                 is_restorable=False,
                 skin=None,
                 type=UnitTypes.aircraft,
             ),
             StationaryObject(
                 belligerent=Belligerents.blue,
                 id='4_Static',
                 code='RadioBeacon',
                 pos=Point2D(151679.84, 88805.39),
                 rotation_angle=0.00,
                 type=UnitTypes.radio,
             ),
             StationaryObject(
                 belligerent=Belligerents.none,
                 id='5_Static',
                 code='CampfireAirfield',
                 pos=Point2D(151428.38, 88817.52),
                 rotation_angle=0.00,
                 type=UnitTypes.stationary,
             ),
             StationaryObject(
                 belligerent=Belligerents.none,
                 id='6_Static',
                 code='Smoke20',
                 pos=Point2D(151404.61, 89009.57),
                 rotation_angle=0.00,
                 type=UnitTypes.stationary,
             ),
             StationaryObject(
                 belligerent=Belligerents.red,
                 id='7_Static',
                 code='SirenCity',
                 pos=Point2D(151984.28, 88577.12),
                 rotation_angle=0.00,
                 type=UnitTypes.stationary,
             ),
             StationaryObject(
                 belligerent=Belligerents.red,
                 id='8_Static',
                 code='Wagon1',
                 pos=Point2D(152292.72, 89662.80),
                 rotation_angle=0.00,
                 type=UnitTypes.stationary,
             ),
             StationaryShip(
                 belligerent=Belligerents.red,
                 id='9_Static',
                 code='G5',
                 recharge_time=1.4,
                 pos=Point2D(83759.05, 115021.15),
                 rotation_angle=0.00,
                 skill=Skills.ace,
                 type=UnitTypes.ship,
                 awakening_time=60.0,
             ),
             StationaryObject(
                 belligerent=Belligerents.red,
                 id='10_Static',
                 code='XXX',
                 pos=Point2D(152292.72, 89662.80),
                 rotation_angle=0.00,
                 type='SomethingUnknown',
             ),
         ],
     }
     self.assertParser(NStationarySectionParser, 'NStationary', lines,
                       expected)
 def test_get_home_bases(self):
     lines = [
         "[BornPlace]",
         "  1 3000 121601 74883 1 1000 200 0 0 0 5000 50 0 1 1 0 0 3.8 1 0 0 0 0",
         "[BornPlace0]",
         "  Bf-109F-4 -1 1sc250 4sc50",
         "  Bf-109G-6_Late 0",
         "  Ju-88A-4 10 28xSC50 28xSC50_2xSC250 28xSC50_4xSC250",
         "  + 2xSC1800 2xSC2000",
         "[BornPlaceCountries0]",
         "  de",
         "  ru",
     ]
     result = self.parser.parse_stream(lines)
     self.assertEqual(
         result, {
             'objects': {
                 'home_bases': [
                     {
                         'belligerent': Belligerents.red,
                         'pos': Point2D(121601.0, 74883.0),
                         'range': 3000,
                         'friction': {
                             'enabled': False,
                             'value': 3.8,
                         },
                         'radar': {
                             'max_height': 5000,
                             'min_height': 0,
                             'range': 50,
                         },
                         'show_default_icon': False,
                         'spawning': {
                             'enabled':
                             True,
                             'in_air': {
                                 'conditions': {
                                     'always': False,
                                     'if_deck_is_full': False,
                                 },
                                 'heading': 0,
                                 'height': 1000,
                                 'speed': 200,
                             },
                             'in_stationary': {
                                 'enabled': False,
                                 'return_to_start_position': False,
                             },
                             'max_pilots':
                             0,
                             'with_parachutes':
                             True,
                             'aircraft_limitations': {
                                 'allowed_aircrafts': [
                                     {
                                         'code':
                                         'Bf-109F-4',
                                         'limit':
                                         None,
                                         'weapon_limitations': [
                                             '1sc250',
                                             '4sc50',
                                         ],
                                     },
                                     {
                                         'code': 'Bf-109G-6_Late',
                                         'limit': 0,
                                         'weapon_limitations': []
                                     },
                                     {
                                         'code':
                                         'Ju-88A-4',
                                         'limit':
                                         10,
                                         'weapon_limitations': [
                                             '28xSC50',
                                             '28xSC50_2xSC250',
                                             '28xSC50_4xSC250',
                                             '2xSC1800',
                                             '2xSC2000',
                                         ]
                                     },
                                 ],
                                 'consider_lost':
                                 True,
                                 'consider_stationary':
                                 True,
                                 'enabled':
                                 True,
                             },
                             'allowed_air_forces': [
                                 AirForces.luftwaffe,
                                 AirForces.vvs_rkka,
                             ],
                         },
                     },
                 ],
             },
         })
 def test_get_moving_units(self):
     lines = [
         "[Chiefs]",
         "  0_Chief Armor.1-BT7 2",
         "[0_Chief_Road]",
         "  21380.02 41700.34 120.00 10 3 3.055555582046509",
         "  21500.00 41700.00 120.00",
         "  50299.58 35699.85 120.00 0 3 2.6388890743255615",
         "  60284.10 59142.93 120.00",
         "  84682.13 98423.69 120.00",
     ]
     result = self.parser.parse_stream(lines)
     expected = {
         'objects': {
             'moving_units': [
                 {
                     'id':
                     '0_Chief',
                     'code':
                     '1-BT7',
                     'type':
                     UnitTypes.armor,
                     'belligerent':
                     Belligerents.blue,
                     'route': [
                         GroundRoutePoint(
                             pos=Point2D(21380.02, 41700.34),
                             is_checkpoint=True,
                             delay=10,
                             section_length=3,
                             speed=11.0,
                         ),
                         GroundRoutePoint(
                             pos=Point2D(21500.00, 41700.00),
                             is_checkpoint=False,
                         ),
                         GroundRoutePoint(
                             pos=Point2D(50299.58, 35699.85),
                             is_checkpoint=True,
                             delay=0,
                             section_length=3,
                             speed=9.5,
                         ),
                         GroundRoutePoint(
                             pos=Point2D(60284.10, 59142.93),
                             is_checkpoint=False,
                         ),
                         GroundRoutePoint(
                             pos=Point2D(84682.13, 98423.69),
                             is_checkpoint=False,
                         ),
                     ],
                 },
             ],
         },
     }
     self.assertEqual(
         result['objects']['moving_units'][0]['route'][0],
         expected['objects']['moving_units'][0]['route'][0],
     )
     self.assertEqual(result, expected)