# Path: app/callwidget/phone_number.py
# class PhoneNumber(object):
#     """
#     A phone number input sanitizer.
#     """
# 
#     def __init__(self, nr):
#         self.phone_number = sub(r'\s', '', str(nr))
#         self.phone_number = sub(r'/', '', self.phone_number)
#         self.phone_number = sub(r'\-', '', self.phone_number)
#         self.phone_number = sub(r'\(', '', self.phone_number)
#         self.phone_number = sub(r'\)', '', self.phone_number)
#         self.phone_number = sub(r'\\', '', self.phone_number)
#         try:
#             self.phone_number = phonenumbers.parse(self.phone_number, None)
#         except NumberParseException:
#             self.phone_number = phonenumbers.parse(self.phone_number, 'DE')
#         finally:
#             return None
#         return self.phone_number
# 
#     def is_from(self, country_code):
#         """
#         :param country_code: an ITU E.164 country code
#         :return: True iff number belongs to that country.
#         """
#         return self.phone_number.country_code == country_code
# 
#     def get_e164_format(self):
#         """
#         :return: String. Telephone Number in canonical ITU E.164 format.
#         """
#         return ''.join(['+', str(self.phone_number.country_code), str(self.phone_number.national_number)])


from app.callwidget.phone_number import PhoneNumber


def test_ill_number_1():
    assert PhoneNumber('+00490301234567').get_e164_format() == '+49301234567'


def test_ill_number_2():
    assert PhoneNumber('(00)49(0)301234567').get_e164_format() == '+49301234567'


def test_ill_number_3():
    assert PhoneNumber('030/1234567').get_e164_format() == '+49301234567'


def test_ill_number_4():
    assert PhoneNumber('030-1234567').get_e164_format() == '+49301234567'


def test_ill_number_5():
    assert PhoneNumber('(+4930)1234567').get_e164_format() == '+49301234567'


def test_ill_number_6():

# Path: app/callwidget/phone_number.py
# class PhoneNumber(object):
#     """
#     A phone number input sanitizer.
#     """
# 
#     def __init__(self, nr):
#         self.phone_number = sub(r'\s', '', str(nr))
#         self.phone_number = sub(r'/', '', self.phone_number)
#         self.phone_number = sub(r'\-', '', self.phone_number)
#         self.phone_number = sub(r'\(', '', self.phone_number)
#         self.phone_number = sub(r'\)', '', self.phone_number)
#         self.phone_number = sub(r'\\', '', self.phone_number)
#         try:
#             self.phone_number = phonenumbers.parse(self.phone_number, None)
#         except NumberParseException:
#             self.phone_number = phonenumbers.parse(self.phone_number, 'DE')
#         finally:
#             return None
#         return self.phone_number
# 
#     def is_from(self, country_code):
#         """
#         :param country_code: an ITU E.164 country code
#         :return: True iff number belongs to that country.
#         """
#         return self.phone_number.country_code == country_code
# 
#     def get_e164_format(self):
#         """
#         :return: String. Telephone Number in canonical ITU E.164 format.
#         """
#         return ''.join(['+', str(self.phone_number.country_code), str(self.phone_number.national_number)])


# Path: tests/test_phone_number_validation.py
from app.callwidget.phone_number import PhoneNumber



def test_ill_number_1():
    assert PhoneNumber('+00490301234567').get_e164_format() == '+49301234567'


def test_ill_number_2():
    assert PhoneNumber('(00)49(0)301234567').get_e164_format() == '+49301234567'


def test_ill_number_3():
    assert PhoneNumber('030/1234567').get_e164_format() == '+49301234567'


def test_ill_number_4():
    assert PhoneNumber('030-1234567').get_e164_format() == '+49301234567'


def test_ill_number_5():
    assert PhoneNumber('(+4930)1234567').get_e164_format() == '+49301234567'


def test_ill_number_6():

    assert PhoneNumber('+0049301234567').get_e164_format() == '+49301234567'