# Path: ogn/parser/aprs_comment/spider_parser.py
# class SpiderParser(BaseParser):
#     def __init__(self):
#         self.beacon_type = 'spider'
#         self.position_pattern = PATTERN_SPIDER_POSITION_COMMENT
# 
#     def parse_position(self, aprs_comment):
#         match = self.position_pattern.match(aprs_comment)
#         return {'spider_id': match.group('spider_id'),
#                 'signal_power': int(match.group('signal_power')) if match.group('signal_power') else None,
#                 'spider_registration': match.group('spider_registration') if match.group('spider_registration') else None,
#                 'gps_quality': match.group('gps_quality') if match.group('gps_quality') else None}


import unittest
from ogn.parser.aprs_comment.spider_parser import SpiderParser



class TestStringMethods(unittest.TestCase):
    def test_position_comment(self):
        message = SpiderParser().parse_position("id300234060668560 +30dB K23W 3D")

        self.assertEqual(message['spider_id'], "300234060668560")
        self.assertEqual(message['signal_power'], 30)
        self.assertEqual(message['spider_registration'], "K23W")

# Path: ogn/parser/aprs_comment/spider_parser.py
# class SpiderParser(BaseParser):
#     def __init__(self):
#         self.beacon_type = 'spider'
#         self.position_pattern = PATTERN_SPIDER_POSITION_COMMENT
# 
#     def parse_position(self, aprs_comment):
#         match = self.position_pattern.match(aprs_comment)
#         return {'spider_id': match.group('spider_id'),
#                 'signal_power': int(match.group('signal_power')) if match.group('signal_power') else None,
#                 'spider_registration': match.group('spider_registration') if match.group('spider_registration') else None,
#                 'gps_quality': match.group('gps_quality') if match.group('gps_quality') else None}


# Path: tests/parser/test_parse_spider.py
import unittest
from ogn.parser.aprs_comment.spider_parser import SpiderParser




class TestStringMethods(unittest.TestCase):
    def test_position_comment(self):
        message = SpiderParser().parse_position("id300234060668560 +30dB K23W 3D")

        self.assertEqual(message['spider_id'], "300234060668560")
        self.assertEqual(message['signal_power'], 30)
        self.assertEqual(message['spider_registration'], "K23W")

        self.assertEqual(message['gps_quality'], "3D")