Ejemplo n.º 1
0
# test for question1.py
from question1 import fizzbuzz

print "fizzbuzz: "
print(fizzbuzz())

"""For this we expect to see numbers divisible by 3 to say fizz,
numbers divisble by 5 to say buzz, and numbers divisible by both
to say fizzbuzz"""

print

#test for question2.py
from question2 import swapchars

print "swapchars: "
print(swapchars("This is a long sentence with many spaces and characters"))
print(swapchars("This.sentence.has.a.lot.of.punctuation"))
print(swapchars("aaaaaa"))
print(swapchars("this uses the intermediate character, ~~ when replacing"))
"""for the last one we expect the ~~ to be replaced when it shouldn't be because
that is the intermediate character used for swapping. I could not think of a way
around that. For the 2nd test the punctuation is most common character. I could
have created a string devoid off all punctuation and spaces, but that seemed
tedious and unnecessary for the assignment. All the other tests behave as expected"""

print

#tests for question3.py
from question3 import sortcat
Ejemplo n.º 2
0
# Import pprint for formatting
from pprint import pprint

# Import functions from assignments for testing
from question1 import fizzbuzz
from question2 import swapchars
from question3 import concat
from question4a import look_away
from question5a import shuttles

# Testing question 1.
print "==testing question 1=="

# Expected output: Numbers 1 through 100, except every multiple of 3, 5, and 15
# are replaced with Fizz, Buzz, and FizzBuzz respectively.
fizzbuzz()

print
print 

# Testing question 2.
# Expected output: 
print "==testing question 2=="

# Expected output: "Thcrc wcrc a lot of cseopcoplcs in thc clcvator on Tucsday."
pprint(swapchars("There were a lot of escopeoples in the elevator on Tuesday."))

# Expected output: "ihhhhhh"
pprint(swapchars("hiiiiii"))

print