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'})