Example #1
0
 def test_wrong_arg_type(self):
     with self.assertRaises(TypeError):
         spam.check_system(0)
Example #2
0
 def test_command_with_invalid_args(self):
     with self.assertRaises(spam.Error):
         spam.check_system("ls --unrecognized-option")
Example #3
0
 def test_command_not_found(self):
     with self.assertRaises(spam.Error):
         spam.check_system("command_not_found")
Example #4
0
 def test_command_with_args(self):
     spam.check_system("ls -l")
Example #5
0
 def test_command(self):
     spam.check_system("ls")
Example #6
0
 def test_false(self):
     with self.assertRaises(spam.Error):
         spam.check_system("false")
Example #7
0
 def test_true(self):
     spam.check_system("true")
Example #8
0
#!/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()