Exemplo n.º 1
0
	def test_error(self):
		'''
		In case of an error, parse_lines() should
		return the line's index.
		'''
		line = split_line('Chandler, Kerri, (623)-668-9293, pink, 123123121')
		self.assertEqual(
			parse_lines(line), None)
Exemplo n.º 2
0
	def test_format_three(self):
		line = split_line('Booker T., Washington, 87360, 373 781 7380, yellow')
		line_dict = {
			"color": "yellow",
			"firstname": "Booker T.",
			"lastname": "Washington",
			"phonenumber": "373-781-7380",
			"zipcode": "87360"
			}

		self.assertEqual(
			parse_lines(line), line_dict)
Exemplo n.º 3
0
	def test_format_two(self):
		line = split_line('James Murphy, yellow, 83880, 018 154 6474')
		line_dict = {
			"color": "yellow",
			"firstname": "James",
			"lastname": "Murphy",
			"phonenumber": "018-154-6474",
			"zipcode": "83880"
			}

		self.assertEqual(
			parse_lines(line), line_dict)
Exemplo n.º 4
0
	def test_format_one(self):
		line = split_line('Chandler, Kerri, (623)-668-9293, pink, 12345')

		line_dict = {
			"color": "pink",
			"firstname": "Kerri",
			"lastname": "Chandler",
			"phonenumber": "623-668-9293",
			"zipcode": "12345"
			}

		self.assertEqual(
			parse_lines(line), line_dict)
Exemplo n.º 5
0
	def test1(self):
		line = 'James Murphy, yellow, 83880, 018 154 6474'
		l = ['James', 'Murphy', 'yellow', '83880', '018 154 6474']
		
		self.assertEqual(split_line(line), l)