File: test_passcode.py

package info (click to toggle)
python-aprslib 0.7.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 352 kB
  • sloc: python: 2,973; makefile: 216
file content (30 lines) | stat: -rw-r--r-- 780 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import unittest
from aprslib import passcode


class TC_pascode(unittest.TestCase):
    def test_nonstring(self):
        with self.assertRaises(AssertionError):
            passcode(5)

    def test_valid_input(self):
        testData = [
            ['TESTCALL', 31742],
            ['testcall', 31742],
            ['tEsTcAlL', 31742],
            ['tEsTcAlL', 31742],
            ['TESTCALL-', 31742],
            ['TESTCALL-12', 31742],
            ['TESTCALL-0', 31742],
            ['N0CALL', 13023],
            ['SUCHCALL', 27890],
            ['MUCHSIGN', 27128],
            ['WOW', 29613],
            ]

        results = []

        for callsign, x in testData:
            results.append([callsign, passcode(callsign)])

        self.assertEqual(testData, results)