def test_unknown(self): self.assertEqual(TypeOfAddress.decode('80'), { 'ton': 'unknown', 'npi': 'unknown' }) self.assertEqual( TypeOfAddress.encode({ 'ton': 'unknown', 'npi': 'unknown' }), '80')
def test_encode_invalid_dict(self): with self.assertRaises(ValueError): TypeOfAddress.encode({})
def test_encode_invalid_ton(self): with self.assertRaises(ValueError): TypeOfAddress.encode({'npi': 'isdn', 'ton': 'strange'})
def test_encode_invalid_npi(self): with self.assertRaises(ValueError): TypeOfAddress.encode({'npi': 'strange', 'ton': 'international'})
def test_decode_invalid_npi(self): with self.assertRaises(ValueError): TypeOfAddress.decode(f'{0x80|0b10:02x}')
def test_decode_invalid_extension(self): with self.assertRaises(ValueError): TypeOfAddress.decode('00')