def test_null(self): testcase = "" expected = "" self.assertEqual(rearrange_name(testcase), expected)
def test_empty(self): testcase = '' expected = '' self.assertEqual(rearrange_name(testcase),expected)
def test_one_name(self): testcase = 'Voltare' expected = 'Voltare' self.assertEqual(rearrange_name(testcase),expected)
def test_basic(self): testcase = "Lovelace, Ada" expected = "Ada Lovelace" self.assertEqual(rearrange_name(testcase), expected)#this method provided to us by the TestCase class we inhereted from to verify
def test_one_name(self): testcase = "Voltaire" expected = "Voltaire" self.assertEqual(rearrange_name(testcase), expected)
def double_name(self): testcase = 'Hridoy, Rakib H.' expected = 'Rakib H. Hridoy' self.assertEqual(rearrange_name(testcase), expected)
def test_empty(self): test_case = "" expected = "" self.assertEqual(rearrange_name(test_case), expected)
def test_isnumeric(self): testcase = "1" self.assertRaises(TypeError, rearrange_name(testcase))
def test_double_name(self): testcase = "Imawanto, Renard I." expected = "Renard I. Imawanto" self.assertEqual(rearrange_name(testcase), expected)
def single(self): testcase = "Plato" expected = "Plato" self.assertEqual(rearrange.rearrange_name(testcase), expected)
def test_single_name(self): testcase = "Siegfried" expected = "Siegfried" self.assertEqual(rearrange_name(testcase), expected)
def test_basic(self): testcase = "Mathew, Pius" expected = "Pius, Mathew" self.assertEqual(rearrange_name(testcase), expected)
def test_one_name(self): testcase = "Mathew" expected = "Mathew" self.assertEqual(rearrange_name(testcase), expected)
def test_basic(self): testcase = 'Guenon, Rene' expected = 'Rene Guenon' self.assertEqual(rearrange_name(testcase), expected)
def test_one_name(self): testCase = "Axel" expected = "Axel" self.assertEqual(rearrange_name(testCase), expected)
def test_basic(self): testcase = "michael ,shanmuk" expected = "Shanmuk Michael" self.assertEqual(rearrange_name(testcase), expected)
""" #%% """ here I am re-phrasing the code in order to use the Match Object x the function "rearrange_name" changes the sequence of the surname, name into name,surname """ import re def rearrange_name(name): x = re.search(r"^([\w .]*), ([\w .]*)$", name) print("{} {}".format(x[2], x[1])) rearrange_name( "Lovelace, Ada" ) # I wrote this argument MANUALLY!! I am calling the function "rearrange_name" by providing the argument Lovelace,Ada # Output is; Ada Lovelace, so perfect, it works #%% """ EXAMPLE 1b we will use the keyword "from" in the Linux OS command line this way we can use the function rearrange_name at the command line, and ofcourse test it by providing an argument in Linux OS command line write: #python3 #from rearrange import rearrange_name as we see the rearrange is the MODULE that contains the rearrange_name FUNCTION
def test_double_name(self): testcase = "is Good, P.Shanmuk" expected = "P.Shanmuk is Good" self.assertEqual(rearrange_name(testcase), expected)
def test_one_name(self): testcase = 'Socrates' expected = 'Socrates' self.assertEqual(rearrange_name(testcase), expected)
def test_double_name(self): testcase = "Shanmuk" expected = "Shanmuk" self.assertEqual(rearrange_name(testcase), expected)
def test_one_name(self): testcase = "Shubham" expected = "Shubham" self.assertEqual(rearrange_name(testcase), expected)
from rearrange import rearrange_name ### manual test ### print(rearrange_name("Jacky, Chaan"))
def test_double_name(self): testcase = "Hopper, Grace M." expected = "Grace M. Hopper" self.assertEqual(rearrange_name(testcase), expected)
def test_single_name(self): testcase = "Madonna" expected = "Madonna" self.assertEqual(rearrange_name(testcase), expected)
def test_basic(self): testcase = "Lovelace, Ada" expected = "Ada Lovelace" self.assertEqual(rearrange_name(testcase), expected)
def test_one_name(self): testcase = "Srilakshmi" expected = "Srilakshmi" self.assertEqual(rearrange_name(testcase), expected)
def test_double_name(self): testcase = 'Hopper, Grace M.' expected = 'Grace M. Hopper' self.assertEqual(rearrange_name(testcase),expected)
def test_basic(self): testcase = "Srilakshmi, Maddali" expected = "Maddali Srilakshmi" self.assertEqual(rearrange_name(testcase),expected)
def test_basic(self): testcase = 'Lovelace, Ada' expected = 'Ada Lovelace' self.assertEqual(rearrange_name(testcase),expected)
def test_basic(self): testcase = "Dib, Tarek" expected = "Tarek Dib" self.assertEqual(rearrange_name(testcase), expected)