Ejemplo n.º 1
0
def test_parse_with_placeholders():
    actual1, actual2 = parse(
        "Hello there, this is {Name}, I am {Age} years old.")
    expected1, expected2 = "Hello there, this is $, I am $ years old.", [
        "Name", "Age"
    ]
    assert actual1 == expected1 and actual2 == expected2
Ejemplo n.º 2
0
def test_parse():
    actual = parse(
        "Hello every one .. My name is {first name} {last name} and I'm {age} years old . I'm {Adjective} and {Adjective}."
    )
    expected = "Hello every one .. My name is {} {} and I'm {} years old . I'm {} and {}.", [
        "first name", "last name", "age", "Adjective", "Adjective"
    ]
    assert actual == expected
Ejemplo n.º 3
0
def test_parse():
    string = 'This is a test for the {second} function which is supposed to return an {array} and a string'
    arr = ['second', 'array']
    actual = parse(string, arr)
    expected = "This is a test for the {} function which is supposed to return an {} and a string", [
        'second', 'array'
    ]
    assert actual == expected
Ejemplo n.º 4
0
def test_two():
    expected = (
        '{noun}{verb}{adverb}{noun}{noun}{adjective}{noun}{noun}{noun}', [
            '{noun}', '{verb}', '{adverb}', '{noun}', '{noun}', '{adjective}',
            '{noun}', '{noun}', '{noun}'
        ])
    actual = parse(open('assets/text.txt').read())
    assert expected == actual
Ejemplo n.º 5
0
def test_parse():
    actual = parse(string_template)
    expected = '''
    Make Me A Video Game!

    I the {} and {} {} have {}{}'s {} sister and plan to steal her {} {}!

    What are a {} and backpacking {} to do? Before you can help {}, you'll have to collect the {} {} and {} {} that open up the {} worlds connected to A {} Lair. There are {} {} and {} {} in the game, along with hundreds of other goodies for you to find.
    '''
    assert actual == expected
def test_parse():
    """
    to test if template fill it with items of list
    """
    try:
        expected = ["bla_bla_1", "bla_bla_2", "bla_Bla_3"]
        actual = parse(
            "I'm {bla_bla_1} and you are {bla_bla_2} and we're {bla_bla_3} ")
        assert actual == expected
    except Exception as e:
        print(f"Error in  test_parse : {e}")
Ejemplo n.º 7
0
def test_parse():
    x = """
    Madlib Game
    %s on the %s and he %s from LTUC students
    so he will %s on his face.
    """

    expected = [
        '\n    Madlib Game\n     on the  and he  from LTUC students\n    so he will  on his face.\n    ',
        ['%s', '%s', '%s', '%s']
    ]
    actual = parse(x)
    assert expected == actual
Ejemplo n.º 8
0
def test_parse():
    assert parse("A {Adjective} and {Adjective} {Noun}") == ["Adjective","Adjective","Noun"]
Ejemplo n.º 9
0
def test_parse():
	actual = parse(read_template(testName))
	expect = ['{test}']
	assert actual == expect
Ejemplo n.º 10
0
def testParse():
    expected = ["first name","age"]
    received = parse("hello {first name}, I am {age} years old")
    assert expected == received
Ejemplo n.º 11
0
def test_parse_no_placeholders():
    actual1, actual2 = parse("Hello there, this is Batool")
    expected1, expected2 = "Hello there, this is Batool", []
    assert actual1 == expected1 and actual2 == expected2
Ejemplo n.º 12
0
def test_parse_empty():
    actual1, actual2 = parse("")
    expected1, expected2 = "", []
    assert actual1 == expected1 and actual2 == expected2
Ejemplo n.º 13
0
def testParse():
    actual = parse("I the {Adjective } and {Adjective} {A First Name}")
    expected = (['Adjective', 'Adjective',
                 'A First Name'], 'I the  {} and  {}  {}')
    assert expected == actual
Ejemplo n.º 14
0
def test_parse_func():
    expected = ["first name","adjective"]
    received = parse("my name is {first name} and I am {adjective}")
    assert expected == received
Ejemplo n.º 15
0
def test_parse():
    expected = ["name", "adjective"]
    received = parse("hello {name}, I am a {adjective} person")
    assert expected == received
Ejemplo n.º 16
0
def test_parse():
    actual = parse("A {Adjective} and {Adjective} {Noun}")
    expected = ['Adjective', 'Adjective', 'Noun']
    assert actual == expected