Sha256: de1d4731ab3ceb242a70d51667dc7863bbae3ce312ff94a574a983fe3dc5eeab
Contents?: true
Size: 1.2 KB
Versions: 131
Compression:
Stored size: 1.2 KB
Contents
import unittest from phone_number import Phone class PhoneTest(unittest.TestCase): def test_cleans_number(self): number = Phone("(123) 456-7890").number self.assertEqual(number, "1234567890") def test_cleans_number_with_dots(self): number = Phone("123.456.7890").number self.assertEqual(number, "1234567890") def test_valid_when_11_digits_and_first_is_1(self): number = Phone("11234567890").number self.assertEqual(number, "1234567890") def test_invalid_when_11_digits(self): number = Phone("21234567890").number self.assertEqual(number, "0000000000") def test_invalid_when_9_digits(self): number = Phone("123456789").number self.assertEqual(number, "0000000000") def test_area_code(self): number = Phone("1234567890") self.assertEqual(number.area_code(), "123") def test_pretty_print(self): number = Phone("1234567890") self.assertEqual(number.pretty(), "(123) 456-7890") def test_pretty_print_with_full_us_phone_number(self): number = Phone("11234567890") self.assertEqual(number.pretty(), "(123) 456-7890") if __name__ == '__main__': unittest.main()
Version data entries
131 entries across 131 versions & 1 rubygems