Beispiel #1
0
def check_72():
    """responds to 72"""
    check50.run("./linear").stdin("72").stdout(
        "Found your number! Bingo!\n").exit()
Beispiel #2
0
def test4():
    """identifies 5105105105105100 as MASTERCARD"""
    check50.run("./credit").stdin("5105105105105100").stdout(
        "MASTERCARD\n").stdout(check50.EOF).exit(0)
Beispiel #3
0
def test6():
    """identifies 4012888888881881 as VISA"""
    check50.run("./credit").stdin("4012888888881881").stdout("VISA\n").stdout(
        check50.EOF).exit(0)
Beispiel #4
0
def test_reject_empty():
    """rejects a non-numeric input of "" """
    check50.run("./credit").stdin("").reject()
Beispiel #5
0
def test2():
    """identifies 371449635398431 as AMEX"""
    check50.run("./credit").stdin("371449635398431").stdout("AMEX\n").stdout(
        check50.EOF).exit(0)
Beispiel #6
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
Beispiel #7
0
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
Beispiel #8
0
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)
Beispiel #9
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)
Beispiel #10
0
def converts_King_to_KiNg():
    """converts King to KiNg"""
    check50.run("./sillystring King").stdout("KiNg").exit(0)
Beispiel #11
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)
Beispiel #12
0
def converts_king_to_kInG():
    """converts king to kInG"""
    check50.run("./sillystring king").stdout("kInG").exit(0)
Beispiel #13
0
def check_12():
    """responds to Plumbus"""
    check50.run("./linear").stdin("Plumbus").reject()
Beispiel #14
0
def check_2():
    """responds to 2"""
    check50.run("./linear").stdin("2").stdout(
        "Sorry better luck next time!\n").exit()
Beispiel #15
0
def blur_edge():
    """blur correctly filters pixel on edge"""
    log(SAMPLE_IMAGES[1])
    check50.run("./testing 3 1").stdout("80 95 105\n")
Beispiel #16
0
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)
Beispiel #17
0
def blur_corner():
    """blur correctly filters pixel in corner"""
    log(SAMPLE_IMAGES[1])
    check50.run("./testing 3 2").stdout("70 85 95\n")
Beispiel #18
0
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)
Beispiel #19
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
Beispiel #20
0
def test_reject_foo():
   """rejects a non-numeric input of "foo" """
   check50.run("./while").stdin("foo").reject()
Beispiel #21
0
def grayscale_multi():
    """grayscale correctly filters simple 3x3 image"""
    log(SAMPLE_IMAGES[0])
    check50.run("./testing 0 3").stdout("85 85 85\n" * 9)
Beispiel #22
0
def test_reject_float():
   """rejects a floating-point number 0.5 """
   check50.run("./while").stdin("55.5").reject()
Beispiel #23
0
def test1():
    """identifies 378282246310005 as AMEX"""
    check50.run("./credit").stdin("378282246310005").stdout("AMEX\n").stdout(
        check50.EOF).exit(0)
Beispiel #24
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
Beispiel #25
0
def test3():
    """identifies 5555555555554444 as MASTERCARD"""
    check50.run("./credit").stdin("5555555555554444").stdout(
        "MASTERCARD\n").stdout(check50.EOF).exit(0)
Beispiel #26
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"]))
Beispiel #27
0
def test5():
    """identifies 4111111111111111 as VISA"""
    check50.run("./credit").stdin("4111111111111111").stdout("VISA\n").stdout(
        check50.EOF).exit(0)
Beispiel #28
0
def blur_middle():
    """blur correctly filters middle pixel"""
    log(SAMPLE_IMAGES[1])
    check50.run("./testing 3 0").stdout("127 140 149\n")
Beispiel #29
0
def test7():
    """identifies 1234567890 as INVALID"""
    check50.run("./credit").stdin("1234567890").stdout("INVALID\n").stdout(
        check50.EOF).exit(0)
Beispiel #30
0
def reject():
    """rejects "Hax0r2" as keyword"""
    check50.run("python3 vigenere.py Hax0r2").exit(1)