def test_wrong_arg_type(self): with self.assertRaises(TypeError): spam.check_system(0)
def test_command_with_invalid_args(self): with self.assertRaises(spam.Error): spam.check_system("ls --unrecognized-option")
def test_command_not_found(self): with self.assertRaises(spam.Error): spam.check_system("command_not_found")
def test_command_with_args(self): spam.check_system("ls -l")
def test_command(self): spam.check_system("ls")
def test_false(self): with self.assertRaises(spam.Error): spam.check_system("false")
def test_true(self): spam.check_system("true")
#!/usr/bin/env python3 import spam print() status = spam.system("ls -l | wc") print("status: ", status) print() print('Expect spam.SpamError') try: status = spam.check_system("false") print("status: ", status) except spam.SpamError as ex: print(' ', ex) print(' ignored') print() s = spam.Spam("Real brand of SPAM") s.print() print(s) print() n1 = spam.Noddy1() print(n1) print() n2 = spam.Noddy2(first="Mike", last="Bentley") print(n2) print("Name: ", n2.name()) print()