コード例 #1
0
 def test_string_in_phone_number(self):
     with self.assertRaises(forms.ValidationError):
         PhoneNumberField().clean('BADNUMBER')
コード例 #2
0
 def test_phone_number_extension_error(self):
     with self.assertRaises(forms.ValidationError):
         PhoneNumberField(allow_extension=False).clean('13035555555ex123')
コード例 #3
0
 def test_international_phone_number(self):
     self.assertEqual(PhoneNumberField().clean('+4991319402813'),
                      '+49 9131 9402813')
コード例 #4
0
 def test_phone_number_with_bad_extension(self):
     with self.assertRaises(forms.ValidationError):
         PhoneNumberField().clean('13035555555ex1BAD')
コード例 #5
0
 def test_phone_number_with_good_extension(self):
     self.assertEqual(PhoneNumberField().clean('13035555555ex555555'),
                      '(303) 555-5555 ext. 555555')
コード例 #6
0
 def test_bad_phone_number(self):
     with self.assertRaises(forms.ValidationError):
         PhoneNumberField().clean('978121')
コード例 #7
0
 def test_good_phone_number(self):
     self.assertEqual(PhoneNumberField().clean('13035555555'),
                      '(303) 555-5555')