def check_72(): """responds to 72""" check50.run("./linear").stdin("72").stdout( "Found your number! Bingo!\n").exit()
def test4(): """identifies 5105105105105100 as MASTERCARD""" check50.run("./credit").stdin("5105105105105100").stdout( "MASTERCARD\n").stdout(check50.EOF).exit(0)
def test6(): """identifies 4012888888881881 as VISA""" check50.run("./credit").stdin("4012888888881881").stdout("VISA\n").stdout( check50.EOF).exit(0)
def test_reject_empty(): """rejects a non-numeric input of "" """ check50.run("./credit").stdin("").reject()
def test2(): """identifies 371449635398431 as AMEX""" check50.run("./credit").stdin("371449635398431").stdout("AMEX\n").stdout( check50.EOF).exit(0)
def grayscale_single_pixel(): """grayscale correctly filters single pixel with whole number average""" log(SAMPLE_PIXEL(20, 40, 90)) check50.run("./testing 0 0").stdout("50 50 50\n") pass
def grayscale_gray(): """grayscale leaves alone pixels that are already gray""" log(SAMPLE_PIXEL(50, 50, 50)) check50.run("./testing 0 2").stdout("50 50 50\n") pass
def test4(): """12 There are 335 days before the given month""" check50.run("./cla_lab_4_1_4_2-A").stdin("12").stdout( "[Tt]here are 335 days before the given month").exit(0)
def test5(): """13 outputs Error: no such month in my calendar""" check50.run("./cla_lab_4_1_4_2-A").stdin("13").stdout( "Error: no such month in my calendar").exit(0)
def converts_King_to_KiNg(): """converts King to KiNg""" check50.run("./sillystring King").stdout("KiNg").exit(0)
def test3(): """4 There are 91 days before the given month""" check50.run("./cla_lab_4_1_4_2-A").stdin("4").stdout( "[Tt]here are 91 days before the given month").exit(0)
def converts_king_to_kInG(): """converts king to kInG""" check50.run("./sillystring king").stdout("kInG").exit(0)
def check_12(): """responds to Plumbus""" check50.run("./linear").stdin("Plumbus").reject()
def check_2(): """responds to 2""" check50.run("./linear").stdin("2").stdout( "Sorry better luck next time!\n").exit()
def blur_edge(): """blur correctly filters pixel on edge""" log(SAMPLE_IMAGES[1]) check50.run("./testing 3 1").stdout("80 95 105\n")
def check_10(): """responds to 10""" check50.run("./while").stdin("10").stdout("Your number can be doubled 3 times before exceeding 100!\n").exit(0)
def blur_corner(): """blur correctly filters pixel in corner""" log(SAMPLE_IMAGES[1]) check50.run("./testing 3 2").stdout("70 85 95\n")
def check_99(compiles): """responds to 99 (edge case)""" check50.run("./while").stdin("99").stdout("Your number can be doubled 0 times before exceeding 100!\n").exit(0)
def grayscale_rounding(): """grayscale correctly filters single pixel without whole number average""" log(SAMPLE_PIXEL(27, 28, 28)) check50.run("./testing 0 1").stdout("28 28 28\n") pass
def test_reject_foo(): """rejects a non-numeric input of "foo" """ check50.run("./while").stdin("foo").reject()
def grayscale_multi(): """grayscale correctly filters simple 3x3 image""" log(SAMPLE_IMAGES[0]) check50.run("./testing 0 3").stdout("85 85 85\n" * 9)
def test_reject_float(): """rejects a floating-point number 0.5 """ check50.run("./while").stdin("55.5").reject()
def test1(): """identifies 378282246310005 as AMEX""" check50.run("./credit").stdin("378282246310005").stdout("AMEX\n").stdout( check50.EOF).exit(0)
def sepia_single_pixel(): """sepia correctly filters single pixel""" log(SAMPLE_PIXEL(20, 40, 90)) check50.run("./testing 1 0").stdout("56 50 39\n") pass
def test3(): """identifies 5555555555554444 as MASTERCARD""" check50.run("./credit").stdin("5555555555554444").stdout( "MASTERCARD\n").stdout(check50.EOF).exit(0)
def reflect_row3(): """reflect correctly filters 1x3 image""" log(SAMPLE_IMAGES[4]) check50.run("./testing 2 1").stdout("".join( ["0 0 255\n", "0 255 0\n", "255 0 0\n"]))
def test5(): """identifies 4111111111111111 as VISA""" check50.run("./credit").stdin("4111111111111111").stdout("VISA\n").stdout( check50.EOF).exit(0)
def blur_middle(): """blur correctly filters middle pixel""" log(SAMPLE_IMAGES[1]) check50.run("./testing 3 0").stdout("127 140 149\n")
def test7(): """identifies 1234567890 as INVALID""" check50.run("./credit").stdin("1234567890").stdout("INVALID\n").stdout( check50.EOF).exit(0)
def reject(): """rejects "Hax0r2" as keyword""" check50.run("python3 vigenere.py Hax0r2").exit(1)