You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
825 B
Python

"""
This file contains all jobs that are used in tests. Each of these test
fixtures has a slighty different characteristics.
"""
13 years ago
def say_hello(name=None):
"""A job with a single argument and a return value."""
if name is None:
name = 'Stranger'
return 'Hi there, %s!' % (name,)
13 years ago
def do_nothing():
"""The best job in the world."""
pass
13 years ago
def div_by_zero(x):
"""Prepare for a division-by-zero exception."""
return x / 0
13 years ago
def some_calculation(x, y, z=1):
"""Some arbitrary calculation with three numbers. Choose z smartly if you
want a division by zero exception.
"""
return x * y / z
13 years ago
def create_file(path):
"""Creates a file at the given path. Actually, leaves evidence that the
job ran."""
with open(path, 'w') as f:
f.write('Just a sentinel.')