Exemplo n.º 1
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "models.Model":
        passed()
    else:
        failed("Use models.Model as an ancestor")
Exemplo n.º 2
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "logger.addHandler(logging.NullHandler())":
        passed()
    else:
        failed()
Exemplo n.º 3
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    answers = [
        ["logging.getLogger()", "logging.root"],
        ["handler.addFilter(log_filter)"]
    ]
    check_answers(placeholders, answers)
Exemplo n.º 4
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    answers = [
        ["handler1"],
        ["handler1"],
    ]
    check_answers(placeholders, answers)
Exemplo n.º 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()
Exemplo n.º 6
0
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")
Exemplo n.º 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")
Exemplo n.º 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.")
Exemplo n.º 9
0
def test_value():
    window = get_answer_placeholders()[0]

    if "monty_python.upper()" in window:
        passed()
    else:
        failed("Benutze die upper()-Methode")
Exemplo n.º 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)
Exemplo n.º 11
0
def test_window():
    windows = get_answer_placeholders()

    if windows[0] == "%d":
        passed()
    else:
        failed("Benutze %d als Symbol")
Exemplo n.º 12
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "__name__":
        passed()
    else:
        failed()
Exemplo n.º 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.')
Exemplo n.º 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?")
Exemplo n.º 15
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "repr(obj)" or placeholder == "obj.__repr__()":
        passed()
    else:
        failed()
Exemplo n.º 16
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "False" or placeholder == '0':
        passed()
    else:
        failed()
Exemplo n.º 17
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "python":
        passed()
    else:
        failed()
Exemplo n.º 18
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "root":
        passed()
    else:
        failed()
Exemplo n.º 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 + "'")
Exemplo n.º 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)")
Exemplo n.º 21
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "1":
        passed()
    else:
        failed(message="Sorry, please try again")
Exemplo n.º 22
0
def test_windows():
    windows = get_answer_placeholders()

    if "number" in windows[0] and "number" in windows[1]:
        passed()
    else:
        failed("Use % operator")
Exemplo n.º 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")
Exemplo n.º 24
0
def test_window():
    window = get_answer_placeholders()[0]

    if " in " in window:
        passed()
    else:
        failed("Use 'in' operator for this check")
Exemplo n.º 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")
Exemplo n.º 26
0
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")
Exemplo n.º 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")
Exemplo n.º 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.')
Exemplo n.º 29
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "logger3.addHandler(logging.NullHandler())":
        passed()
    else:
        failed()
Exemplo n.º 30
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "":  # TODO: your condition here
        passed()
    else:
        failed()
Exemplo n.º 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')
Exemplo n.º 32
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    answers = [
        ['%(asctime)s %(levelname)s %(message)s'],
        ['setFormatter(fmt)']
    ]
    check_answers(placeholders, answers)
Exemplo n.º 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)
Exemplo n.º 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.")
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 37
0
def test_window():
    window = get_answer_placeholders()[0]

    if " in " in window:
        passed()
    else:
        failed("Use 'in' operator for this check")
Exemplo n.º 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.')
Exemplo n.º 39
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if placeholder == "if logger.isEnabledFor(logging.DEBUG):":
        passed()
    else:
        failed()
Exemplo n.º 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()
Exemplo n.º 41
0
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")
Exemplo n.º 42
0
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")
Exemplo n.º 43
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0]
    if "^$" in placeholder:
        passed()
    else:
        failed("Use '^$' to match empty string")
Exemplo n.º 44
0
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")
Exemplo n.º 45
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()

    # placeholder tests
    placeholder_smart_compare(placeholders[0],
                              """sum( finances )""",
                              human_nr=1)
Exemplo n.º 46
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    answers = [
        ['console'],
        ['log_config']
    ]
    check_answers(placeholders, answers)
Exemplo n.º 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     )
Exemplo n.º 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.')
Exemplo n.º 49
0
def test_answer_placeholders():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[0].replace('"', "'")
    if placeholder == "filename=log_filename":
        passed()
    else:
        failed()
Exemplo n.º 50
0
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'")
Exemplo n.º 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")
Exemplo n.º 52
0
def test_title():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[1]
    if "title" in placeholder:
        passed()
    else:
        failed("Define title variable")
Exemplo n.º 53
0
def test_window():
    windows = get_answer_placeholders()

    if windows[0] == "%d":
        passed()
    else:
        failed("Use %d special symbol")
Exemplo n.º 54
0
def test_published_date():
    placeholders = get_answer_placeholders()
    placeholder = placeholders[2]
    if "published_date" in placeholder:
        passed()
    else:
        failed("Define published_date variable")
Exemplo n.º 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"')
Exemplo n.º 56
0
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)")
Exemplo n.º 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!")