Example #1
0
def tests_for_hw4_solution1():
    u"""Тесты задачи 1"""
    assert hw4_solution1.percentage_1("A") == {'a': 100.0}
    assert hw4_solution1.percentage_1("ABCda") == {
        'a': 40.0, 'b': 20.0, 'c': 20.0, 'd': 20.0
    }
    assert hw4_solution1.percentage_1("AsBCda") == {
        'a': 33.3, 'b': 16.7, 'c': 16.7, 'd': 16.7, 's': 16.7
    }
    assert hw4_solution1.percentage_1("q TyU#!{}.") == {
        'q': 25.0, 't': 25.0, 'y': 25.0, 'u': 25.0
    }
    assert sum(hw4_solution1.percentage_1("q TyU#!{}.").values()) == 100.0

    assert hw4_solution1.percentage_2("A") == {'a': 100.0}
    assert hw4_solution1.percentage_2("ABCda") == {
        'a': 40.0, 'b': 20.0, 'c': 20.0, 'd': 20.0
    }
    assert hw4_solution1.percentage_2("AsBCda") == {
        'a': 33.3, 'b': 16.7, 'c': 16.7, 'd': 16.7, 's': 16.7
    }
    assert hw4_solution1.percentage_2("q TyU#!{}.") == {
        'q': 25.0, 't': 25.0, 'y': 25.0, 'u': 25.0
    }
    assert sum(hw4_solution1.percentage_2("q TyU#!{}.").values()) == 100.0
Example #2
0
def tests_for_hw4_solution1():
    u"""Тесты задачи 1"""
    assert hw4_solution1.percentage_1("A") == {'a': 100.0}
    assert hw4_solution1.percentage_1("ABCda") == {'a': 40.0, 'b': 20.0, 'c': 20.0, 'd': 20.0}
    assert hw4_solution1.percentage_1("AsBCda") == {'a': 33.3, 'b': 16.7, 'c': 16.7, 'd': 16.7, 's': 16.7}
    assert hw4_solution1.percentage_1("q TyU#!{}.") == {'q': 25.0, 't': 25.0, 'y': 25.0, 'u': 25.0}
    assert sum(hw4_solution1.percentage_1("q TyU#!{}.").values()) == 100.0

    assert hw4_solution1.percentage_2("A") == {'a': 100.0}
    assert hw4_solution1.percentage_2("ABCda") == {'a': 40.0, 'b': 20.0, 'c': 20.0, 'd': 20.0}
    assert hw4_solution1.percentage_2("AsBCda") == {'a': 33.3, 'b': 16.7, 'c': 16.7, 'd': 16.7, 's': 16.7}
    assert hw4_solution1.percentage_2("q TyU#!{}.") == {'q': 25.0, 't': 25.0, 'y': 25.0, 'u': 25.0}
    assert sum(hw4_solution1.percentage_2("q TyU#!{}.").values()) == 100.0
Example #3
0
def runner():
    """Starts execution of all tasks"""
    print INPUT_1, ">>\n", hw4_solution1.percentage_1(INPUT_1)

    print INPUT_2, ">>\n", hw4_solution2.ellipsis_1(INPUT_2)
    print INPUT_2, ">>\n", hw4_solution2.ellipsis_1(INPUT_2, 10)
    print INPUT_2, ">>\n", hw4_solution2.ellipsis_1(INPUT_2, 15)
Example #4
0
def runner():
    """Starts execution of all tasks"""
    print INPUT_1, ">>\n", hw4_solution1.percentage_1(INPUT_1)

    print INPUT_2, ">>\n", hw4_solution2.ellipsis_1(INPUT_2)
    print INPUT_2, ">>\n", hw4_solution2.ellipsis_1(INPUT_2, 10)
    print INPUT_2, ">>\n", hw4_solution2.ellipsis_1(INPUT_2, 15)
Example #5
0
def runner():
    u"""Запускает выполнение всех задач"""
    print INPUT_1, ">>\n", hw4_solution1.percentage_1(INPUT_1)
    print INPUT_1, ">>\n", hw4_solution1.percentage_2(INPUT_1)

    print INPUT_2, ">>\n", hw4_solution2.ellipsis_1(INPUT_2)
    print INPUT_2, ">>\n", hw4_solution2.ellipsis_1(INPUT_2, 10)
    print INPUT_2, ">>\n", hw4_solution2.ellipsis_1(INPUT_2, 15)
Example #6
0
def runner():
    u"""Запускает выполнение всех задач"""
    print "======== STARTER.PY ================================"
    print "___ function percentage_1 ____"
    print INPUT_1, ">>\n", hw4_solution1.percentage_1(INPUT_1)
    print "___ function percentage_2 ____"
    print INPUT_1, ">>\n", hw4_solution1.percentage_2(INPUT_1)

    print "___ function ellipsis_1 ____"
    print INPUT_2, ">>\n", hw4_solution2.ellipsis_1(INPUT_2)
    print INPUT_2, ">>\n", hw4_solution2.ellipsis_1(INPUT_2, 10)
    print INPUT_2, ">>\n", hw4_solution2.ellipsis_1(INPUT_2, 15)