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
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
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
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
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}")
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
def test_parse(): assert parse("A {Adjective} and {Adjective} {Noun}") == ["Adjective","Adjective","Noun"]
def test_parse(): actual = parse(read_template(testName)) expect = ['{test}'] assert actual == expect
def testParse(): expected = ["first name","age"] received = parse("hello {first name}, I am {age} years old") assert expected == received
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
def test_parse_empty(): actual1, actual2 = parse("") expected1, expected2 = "", [] assert actual1 == expected1 and actual2 == expected2
def testParse(): actual = parse("I the {Adjective } and {Adjective} {A First Name}") expected = (['Adjective', 'Adjective', 'A First Name'], 'I the {} and {} {}') assert expected == actual
def test_parse_func(): expected = ["first name","adjective"] received = parse("my name is {first name} and I am {adjective}") assert expected == received
def test_parse(): expected = ["name", "adjective"] received = parse("hello {name}, I am a {adjective} person") assert expected == received
def test_parse(): actual = parse("A {Adjective} and {Adjective} {Noun}") expected = ['Adjective', 'Adjective', 'Noun'] assert actual == expected