Beispiel #1
0
 def test_from_frequency(self):
     for channel, data in self.DATA:
         for navaid, frequency in data.items():
             if frequency is None:
                 continue
             with self.subTest(frequency=frequency):
                 result = TACAN.from_frequency(frequency)
                 self.assertEqual(result, (channel, navaid))
Beispiel #2
0
 def test_to_frequency(self):
     for channel, data in self.DATA:
         for navaid, frequency in data.items():
             with self.subTest(channel=channel, navaid=navaid):
                 result = TACAN(channel).to_frequency(navaid)
                 if frequency is None:
                     self.assertIsNone(result)
                 else:
                     self.assertAlmostEqual(result, frequency, places=2)
Beispiel #3
0
 def test_ordering(self):
     self.assertEqual(TACAN('1X'), TACAN('1X'))
     self.assertNotEqual(TACAN('1X'), TACAN('1Y'))
     self.assertLess(TACAN('1X'), TACAN('1Y'))
     self.assertLessEqual(TACAN('1X'), TACAN('1X'))
     self.assertGreater(TACAN('2X'), TACAN('1Y'))
     self.assertGreaterEqual(TACAN('2X'), TACAN('1X'))
     self.assertIs(TACAN('1X').__eq__(None), NotImplemented)
     self.assertIs(TACAN('1X').__ne__(None), NotImplemented)
     self.assertIs(TACAN('1X').__lt__(None), NotImplemented)
     self.assertIs(TACAN('1X').__le__(None), NotImplemented)
     self.assertIs(TACAN('1X').__gt__(None), NotImplemented)
     self.assertIs(TACAN('1X').__ge__(None), NotImplemented)
Beispiel #4
0
 def test_repr(self):
     self.assertEqual(repr(TACAN('1X')), "TACAN('1X')")
Beispiel #5
0
 def test_str(self):
     obj = TACAN('1X')
     self.assertEqual(str(obj), '1X')
     self.assertEqual(str(obj), obj.channel)
Beispiel #6
0
 def test_immutable(self):
     with self.assertRaisesRegex(TypeError, r'^TACAN objects are immutable\.$'):
         TACAN('1X').channel = '1X'
Beispiel #7
0
 def _test_constructor_error(self, *values, exception=None):
     for value in values:
         with self.subTest(value):
             with self.assertRaisesRegex(exception, f'^Invalid TACAN channel: {re.escape(repr(value))}$'):
                 TACAN(value)