Ejemplo n.º 1
0
 def test_raises_invalid_phone_number_for_invalid_phone_number(self):
     with pytest.raises(InvalidPhoneNumber) as exc_info:
         _deconstruct_phone_number("+461234567890")
     assert exc_info.value.error_type == InvalidPhoneNumber.INVALID
Ejemplo n.º 2
0
 def test_raises_invalid_phone_number_for_insufficient_country_data(self):
     with pytest.raises(InvalidPhoneNumber) as exc_info:
         _deconstruct_phone_number("0701")
     assert exc_info.value.error_type == InvalidPhoneNumber.INVALID_COUNTRY_CODE
Ejemplo n.º 3
0
 def test_raises_invalid_phone_number_for_parse_exception(self):
     with pytest.raises(InvalidPhoneNumber) as exc_info:
         _deconstruct_phone_number("0")
     assert exc_info.value.error_type == InvalidPhoneNumber.NOT_A_NUMBER
Ejemplo n.º 4
0
 def test_can_parse_national_phone_number_with_country_code(self):
     result = _deconstruct_phone_number("0123456789", "SE")
     assert result.country_code == 46
     assert result.national_number == 123456789