def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "models.Model":
        passed()
    else:
        failed("Use models.Model as an ancestor")
Example #2
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "logger.addHandler(logging.NullHandler())":
        passed()
    else:
        failed()
Example #3
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    answers = [
        ["logging.getLogger()", "logging.root"],
        ["handler.addFilter(log_filter)"]
    ]
    check_answers(placeholders, answers)
Example #4
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    answers = [
        ["handler1"],
        ["handler1"],
    ]
    check_answers(placeholders, answers)
Example #5
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0].replace('"', "'")
    if placeholder == "'%(asctime)s %(levelname)s %(message)s'":
        passed()
    else:
        failed()
def test_answer_placeholders2():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if "{{" in placeholder and "}}" in placeholder and "post" in placeholder:
        passed()
    else:
        failed("Use {{ post }} to print post content")
Example #7
0
def test_window2():
    window = get_answer_placeholders()[1]
    output = get_file_output()
    if len(output) > 1 and output[1] == "This is a red car.":
        passed()
    else:
        failed("Change color using assignment to the car2.color")
Example #8
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0].replace('"', "'")
    if placeholder.startswith("logger.exception(") and placeholder.find("'") != -1:
        passed()
    else:
        failed("That is not correct. Be sure to call exception() with a string argument.")
def test_value():
    window = get_answer_placeholders()[0]

    if "monty_python.upper()" in window:
        passed()
    else:
        failed("Benutze die upper()-Methode")
Example #10
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()

    # placeholder tests
    placeholder_smart_compare(placeholders[0], """2, 5""", human_nr=1)

    placeholder_smart_compare(placeholders[1], """b, a""", human_nr=2)
Example #11
0
def test_window():
    windows = get_answer_placeholders()

    if windows[0] == "%d":
        passed()
    else:
        failed("Benutze %d als Symbol")
Example #12
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "__name__":
        passed()
    else:
        failed()
Example #13
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0].replace('"', "'")
    if placeholder == "logger = logging.getLogger('mortgage.rate')":
        passed()
    else:
        failed('Sorry, that is not correct. Check the Hint for more help.')
Example #14
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    not_correct = placeholders[0]
    while_condition = placeholders[1]
    user_input = placeholders[2]
    equals_to = placeholders[3]
    less_than = placeholders[4]
    if not_correct == "True":  # TODO: your condition here
        passed()
    else:
        failed("When we start, should the user be correct or incorrect?")
    if while_condition == "not_correct":
        passed()
    else:
        failed("We want the loop to keep running when what is True?")
    if "raw_input(" in user_input:
        passed()
    else:
        failed("This is where we ask the user to guess the number")
    if "==" in equals_to:
        passed()
    else:
        failed("When does the user win?")
    if "<" in less_than:
        passed()
    else:
        failed("When should we say higher than?")
Example #15
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "repr(obj)" or placeholder == "obj.__repr__()":
        passed()
    else:
        failed()
Example #16
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "False" or placeholder == '0':
        passed()
    else:
        failed()
Example #17
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "python":
        passed()
    else:
        failed()
Example #18
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "root":
        passed()
    else:
        failed()
Example #19
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "counter":
        passed()
    else:
        failed("Variable name should be 'counter' not '" + placeholder + "'")
Example #20
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[1]
    if "raw_input(" in placeholder:
        passed()
    else:
        failed("Remember to use raw_input(prompt)")
Example #21
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "1":
        passed()
    else:
        failed(message="Sorry, please try again")
Example #22
0
def test_windows():
    windows = get_answer_placeholders()

    if "number" in windows[0] and "number" in windows[1]:
        passed()
    else:
        failed("Use % operator")
Example #23
0
def test_answer_placeholders1():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[2]
    if "{%" in placeholder and "%}" in placeholder and "endfor" in placeholder:
        passed()
    else:
        failed("Don't forget to close for tag")
def test_window():
    window = get_answer_placeholders()[0]

    if " in " in window:
        passed()
    else:
        failed("Use 'in' operator for this check")
Example #25
0
def test_answer_placeholders2():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[2]
    if "{{" in placeholder and "}}" in placeholder and "post" in placeholder:
        passed()
    else:
        failed("Use {{ post }} to print post content")
def test_title1():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[1]
    if "CharField" in placeholder and "max_length" in placeholder and "200" in placeholder:
        passed()
    else:
        failed("Create models.CharField(max_length=200) here")
Example #27
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[2]
    if "{%" in placeholder and "%}" in placeholder and "for" in placeholder:
        passed()
    else:
        failed("Use '{% for ... in ... %}' tag")
Example #28
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "'COME AT NOON'" or placeholder == '"COME AT NOON"':
        passed()
    else:
        failed(message='Please try again.')
Example #29
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "logger3.addHandler(logging.NullHandler())":
        passed()
    else:
        failed()
Example #30
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "":  # TODO: your condition here
        passed()
    else:
        failed()
Example #31
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if "print(" in placeholder:
        passed()
    else:
        failed('use the print() function with a number between 1 and 3')
Example #32
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    answers = [
        ['%(asctime)s %(levelname)s %(message)s'],
        ['setFormatter(fmt)']
    ]
    check_answers(placeholders, answers)
Example #33
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()

    # placeholder tests
    placeholder_smart_compare(placeholders[0],
                              """[x for x in finances if x > 0]""",
                              human_nr=1)
Example #34
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "print":  # TODO: your condition here
        passed()
    else:
        failed("Use the print luke.")
Example #35
0
def test_nodes():
    placeholders = get_answer_placeholders()
    wool0 = "wool:" + placeholders[0]
    wool1 = "wool:" + placeholders[1]
    pybotnick = "pt" + mtuser
    if len(pybotnick) > NICK_MAX_LEN:
        pybotnick = pybotnick[0:NICK_MAX_LEN]
    mc = MinetestConnection.create(ircserver,
                                   mtuser,
                                   mtuserpass,
                                   mtbotnick,
                                   channel,
                                   pybotnick=pybotnick)
    z = int(mc.send_cmd("get_player_z " + mtuser))
    # floor
    count_0 = 81 - int(
        mc.compare_nodes(x - 4, y - 4, z, x + 4, y + 4, z, wool0))
    count_1 = 81 - int(
        mc.compare_nodes(x - 4, y - 4, z, x + 4, y + 4, z, wool1))
    if count_0 > 45:
        failed("Too many " + wool0 + ". Should be less than 46 but are " +
               count_0)
    elif count_1 > 45:
        failed("Too many " + wool1 + ". Should be less than 46 but are " +
               count_1)
    elif count_0 < 36:
        failed("Too few " + wool0 + ". Should be at least 36 but are " +
               count_0)
    elif count_1 < 36:
        failed("Too few " + wool1 + ". Should be at least 36 but are " +
               count_1)
    else:
        passed()
Example #36
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    if placeholders[1].replace("\'", "\"") == '"hot "' and placeholders[0].replace(" ", "").replace("\'", "\"") == '"grass"+"hopper"' \
            and placeholders[2].replace(" ", "").replace("\'", "\"") == '"l"+"a"+"d"+"y"+"b"+"u"+"g"':
        passed()
    else:
        failed()
Example #37
0
def test_window():
    window = get_answer_placeholders()[0]

    if " in " in window:
        passed()
    else:
        failed("Use 'in' operator for this check")
Example #38
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "%a %b %d %Y %I:%M:%S%p":
        passed()
    else:
        failed('Sorry, that is not correct. Check the Hint for the correct answer.')
Example #39
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "if logger.isEnabledFor(logging.DEBUG):":
        passed()
    else:
        failed()
Example #40
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if (placeholder[:7] == 'print("' or placeholder[:7] == "print('") and (placeholder[-2:] == '")' or placeholder[-2:] == "')") :
        passed()
    else:
        failed()
def test_answer_placeholders1():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if "views.post_list" in placeholder:
        passed()
    else:
        failed("Map url to the views.post_list")
def test_answer_placeholders1():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if "{%" in placeholder and "%}" in placeholder and "endfor" in placeholder:
        passed()
    else:
        failed("Don't forget to close for tag")
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if "^$" in placeholder:
        passed()
    else:
        failed("Use '^$' to match empty string")
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if "{%" in placeholder and "%}" in placeholder and "for" in placeholder:
        passed()
    else:
        failed("Use '{% for ... in ... %}' tag")
Example #45
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()

    # placeholder tests
    placeholder_smart_compare(placeholders[0],
                              """sum( finances )""",
                              human_nr=1)
Example #46
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    answers = [
        ['console'],
        ['log_config']
    ]
    check_answers(placeholders, answers)
Example #47
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()

    # placeholder tests
    placeholder_smart_compare(placeholders[0], """, x in enumerate(finances)""", human_nr=1     )

    placeholder_smart_compare(placeholders[1], """x""", human_nr=2     )
Example #48
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder.find('service_address') != -1:
        passed()
    else:
        failed('Sorry that is not correct. Check the Hint for more help.')
Example #49
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0].replace('"', "'")
    if placeholder == "filename=log_filename":
        passed()
    else:
        failed()
def test_ice_cream():
    window = get_answer_placeholders()[0]

    if "ice cream" in window or "ice_cream":
        passed()
    else:
        failed("Check if there is 'ice' in 'ice cream'")
Example #51
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder in time_zones:
        passed()
    else:
        failed("Please, type valid timezone")
def test_title():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[1]
    if "title" in placeholder:
        passed()
    else:
        failed("Define title variable")
Example #53
0
def test_window():
    windows = get_answer_placeholders()

    if windows[0] == "%d":
        passed()
    else:
        failed("Use %d special symbol")
def test_published_date():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[2]
    if "published_date" in placeholder:
        passed()
    else:
        failed("Define published_date variable")
Example #55
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if "blast off" == placeholder:
        passed()
    else:
        failed('Incorrect action. Should be "blast off"')
def test_published_date1():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[2]
    if "DateTimeField" in placeholder and "blank" in placeholder and "null" in placeholder:
        passed()
    else:
        failed("Define variable as DateTimeField(blank=True, null=True)")
Example #57
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder.lower() in ["\"hello world\"", "'hello world'"]:
        passed()
    else:
        failed("You didnt print hello world!")