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