コード例 #1
0
ファイル: test_aprs.py プロジェクト: mikekiwa/shinysdr
 def setUp(self):
     self.s = APRSStation('TEST')
コード例 #2
0
ファイル: test_aprs.py プロジェクト: mikekiwa/shinysdr
class TestAPRSStation(unittest.TestCase):
    def setUp(self):
        self.s = APRSStation('TEST')

    def __message(self, facts):
        return APRSMessage(receive_time=_dummy_receive_time,
                           source='',
                           destination='',
                           via='',
                           payload='',
                           facts=facts,
                           errors=[],
                           comment='')

    def test_address(self):
        self.assertEqual(self.s.get_address(), 'TEST')

    def test_track(self):
        self.assertEqual(empty_track, self.s.get_track())
        self.s.receive(
            self.__message([
                Position(31, -42),
                Altitude(1000, True),
            ]))
        self.assertEqual(
            empty_track._replace(
                latitude=TelemetryItem(31, _dummy_receive_time),
                longitude=TelemetryItem(-42, _dummy_receive_time),
                altitude=TelemetryItem(304.8, _dummy_receive_time)),
            self.s.get_track())

    def test_symbol(self):
        self.assertEqual('', self.s.get_symbol())
        self.s.receive(self.__message([Symbol('/=')]))
        self.assertEqual('/=', self.s.get_symbol())

    def test_status(self):
        self.assertEqual('', self.s.get_status())
        self.s.receive(self.__message([Status('foo')]))
        self.assertEqual('foo', self.s.get_status())
コード例 #3
0
ファイル: test_aprs.py プロジェクト: shadown/shinysdr
	def setUp(self):
		self.s = APRSStation('TEST')
コード例 #4
0
ファイル: test_aprs.py プロジェクト: shadown/shinysdr
class TestAPRSStation(unittest.TestCase):
	def setUp(self):
		self.s = APRSStation('TEST')
		
	def __message(self, facts):
		return APRSMessage(
			receive_time=_dummy_receive_time,
			source='',
			destination='',
			via='',
			payload='',
			facts=facts,
			errors=[],
			comment='')
	
	def test_address(self):
		self.assertEqual(self.s.get_address(), 'TEST')
	
	def test_position(self):
		self.assertEqual(None, self.s.get_position())
		self.s.receive(self.__message([
			Position(31, -42)
		]))
		self.assertEqual((31, -42, _dummy_receive_time), self.s.get_position())
		
	def test_symbol(self):
		self.assertEqual(None, self.s.get_symbol())
		self.s.receive(self.__message([
			Symbol('/=')
		]))
		self.assertEqual('/=', self.s.get_symbol())
		
	def test_status(self):
		self.assertEqual('', self.s.get_status())
		self.s.receive(self.__message([
			Status('foo')
		]))
		self.assertEqual('foo', self.s.get_status())
コード例 #5
0
class TestAPRSStation(unittest.TestCase):
    def setUp(self):
        self.s = APRSStation('TEST')
        
    def __message(self, facts):
        return APRSMessage(
            receive_time=_dummy_receive_time,
            source='',
            destination='',
            via='',
            payload='',
            facts=facts,
            errors=[],
            comment='')
    
    def test_address(self):
        self.assertEqual(self.s.get_address(), 'TEST')
    
    def test_track(self):
        self.assertEqual(empty_track, self.s.get_track())
        self.s.receive(self.__message([
            Position(31, -42),
            Altitude(1000, True),
        ]))
        self.assertEqual(empty_track._replace(
            latitude=TelemetryItem(31, _dummy_receive_time),
            longitude=TelemetryItem(-42, _dummy_receive_time),
            altitude=TelemetryItem(304.8, _dummy_receive_time)
        ), self.s.get_track())
        
    def test_symbol(self):
        self.assertEqual(None, self.s.get_symbol())
        self.s.receive(self.__message([
            Symbol('/=')
        ]))
        self.assertEqual('/=', self.s.get_symbol())
        
    def test_status(self):
        self.assertEqual('', self.s.get_status())
        self.s.receive(self.__message([
            Status('foo')
        ]))
        self.assertEqual('foo', self.s.get_status())
コード例 #6
0
class TestAPRSStation(unittest.TestCase):
    def setUp(self):
        self.s = APRSStation('TEST')

    def __message(self, facts):
        return APRSMessage(receive_time=_dummy_receive_time,
                           source='',
                           destination='',
                           via='',
                           payload='',
                           facts=facts,
                           errors=[],
                           comment='')

    def test_address(self):
        self.assertEqual(self.s.get_address(), 'TEST')

    def test_position(self):
        self.assertEqual(None, self.s.get_position())
        self.s.receive(self.__message([Position(31, -42)]))
        self.assertEqual((31, -42, _dummy_receive_time), self.s.get_position())

    def test_symbol(self):
        self.assertEqual(None, self.s.get_symbol())
        self.s.receive(self.__message([Symbol('/=')]))
        self.assertEqual('/=', self.s.get_symbol())

    def test_status(self):
        self.assertEqual('', self.s.get_status())
        self.s.receive(self.__message([Status('foo')]))
        self.assertEqual('foo', self.s.get_status())