Exemple #1
0
def transform_source(source, callback_params=None, **kwargs):
    """This function is called by the import hook loader and uses
    transformations from two other examples.
    """
    if callback_params["show_original"]:
        utils.print_source(source, "Original")

    source = french.french_to_english(source)
    source = repeat.convert_repeat(source)

    if callback_params["show_transformed"]:
        utils.print_source(source, "Transformed")

    return source
Exemple #2
0
def test_repeat_while():
    source = "repeat while condition:"
    # note extra space between while and condition as we removed a keyword
    assert repeat.convert_repeat(source) == "while  condition:"
Exemple #3
0
def test_repeat_until():
    source = "repeat until condition: # a comment"
    assert repeat.convert_repeat(source) == "while not condition: # a comment"
Exemple #4
0
def test_repeat_forever():
    source = "   repeat  forever:"
    assert repeat.convert_repeat(
        source) == "   while  True:", "repeat forever test"
Exemple #5
0
def test_predictable():
    assert converted == repeat.convert_repeat(
        source, predictable_names=True), "Testing predicted conversion."