Пример #1
0
def flip_name(name):
    ''' takes a string in the format of Firstname Lastname and returns a string of Lastname, Firstname, uses the names function
    from billy to make a tuple and then rearranges it.'''  
    first_last = split_name(name)
    if first_last is not None:
        firstname, lastname = first_last
        return lastname + ", " + firstname
    else:
        return name
Пример #2
0
	def test_None_on_non_matching_strings(self):
		"Test that we return ``None`` on non-matching strings."
		# Sorry, Yao Ming.
		for name in u"姚明", "1234":
			self.assertIsNone(split_name(name))
Пример #3
0
	def test_split_name(self):
		"Test that input matches the expected output."
		output = sorted(split_name(name) for name in self.NAMES)
		self.assertEqual(output, sorted(self.EXPECTED))