def test_merge_func(): inputs = ['mais', '23', 'python'] words_lis = ['name', 'age', 'language'] text = 'my name is %s and my age is %s I love %s' received = merge(text, inputs,words_lis) expected = 'my name is mais and my age is 23 I love python' assert expected == received
def test_merge(): actual = merge( "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.", [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21" ]) expected = "Make Me A Video Game! I the 1 and 2 3 have 45's 6 sister and plan to steal her 7 8! What are a 9 and backpacking 10 to do? Before you can help 11, you'll have to collect the 12 13 and 14 15 that open up the 16 worlds connected to A 17 Lair. There are 18 19 and 20 21 in the game, along with hundreds of other goodies for you to find." assert actual == expected
def test_merge(): actual = merge("It was a {} and {} {}.", ("dark", "stormy", "night")) expected = "It was a dark and stormy night." assert actual == expected # def test_read_template_raises_exception_with_bad_path(): # with pytest.raises(FileNotFoundError): # path = "missing.txt" # read_template(path)
def test_merge(): """ to merge contents of list and fill it in template. """ try: inserts = ["Mohamad", "Bechlor's degree", " 5 dogs"] template = "i am %s, I have %s, I have %s" parse = ["Name", "Your's Degree", "1-100 animal"] expected = "i am Mohamad, I have Bechlor's degree, I have 5 dogs" actual = merge(template, inserts, parse) assert actual == expected except Exception as e: print(f"Error in test_parse : {e}")
def test_merge(): x = """ Madlib Game %s on the %s and he %s from LTUC students so he will %s on his face. """ y = ["ali", "tree", "afraid", "hit"] expected = """ Madlib Game ali on the tree and he afraid from LTUC students so he will hit on his face. """ actual = merge(x, y) assert expected == actual
def test_merge(): actual = merge('this is a {test}', ['string']) expect = 'this is a string' assert actual == expect
print(""" **************************************************** Welcome. We are going to play Madlibs! You will be prompted with a series of prompts. Provde appropriate responses to complete the Madlib **************************************************** """) user_responses = [] def get_responses(): adj1 = input("Provide an Adjective ") user_responses.append(adj1) adj2 = input("Provide another Adjective ") user_responses.append(adj2) noun1 = input("Provide a Noun ") user_responses.append(noun1) madlib = read_template("assets/dark_and_stormy_night.txt") parsed_text, words = parse_template(madlib) parts = get_responses() print(user_responses) print(merge(parsed_text, user_responses))
def testMerge(): words = ['smart', 'boxes', 'hungry', 'eat'] text = 'A {} {} had a {} dog so they {} them' received = merge(text, words) expected = 'A smart boxes had a hungry dog so they eat them' assert expected == received
def test_merge_with_placeholders(): actual = merge("Hello there, this is $, I am $ years old", ["Batool", "24"]) expected = "Hello there, this is Batool, I am 24 years old" assert actual == expected
def test_merge_no_placeholders(): actual = merge("Hello there, this is Batool", []) expected = "Hello there, this is Batool" assert actual == expected
def test_merge(): print(remove_template_words('some {words} to {test}')) actual = merge('some {words} to {test}', ['one', 'two']) expect = 'some one to two' assert actual == expect
def test_merge(): actual = merge( "Hello every one .. My name is {} {} and I'm {} years old . I'm {} and {}.", ["f", "f", "f", "f", "f"]) expected = "Hello every one .. My name is f f and I'm f years old . I'm f and f." assert actual == expected
def test_merge(): actual = merge(['Rose', 'Beautifull'], 'A {} and {}') expected = "A Rose and Beautifull" assert actual == expected
def test_merge(): string = 'The {} is very {}.' arr = ['car', 'fast'] actual = merge(string, arr) expected = 'The car is very fast.' assert actual == expected
def test_merge(): words = ['hungry', 'eat', 'find'] text = 'i was {} and i had to {} a fruit becuase i couldnt {} anything' received = merge(text, words) expected = 'i was hungry and i had to eat a fruit becuase i couldnt find anything' assert expected == received
def test_merge(): actual = merge("A {} and {} {}.", ["dark", "stormy", "night"]) expected = "A dark and stormy night." assert actual == expected
def test_merge(): actual = merge("It was a {} and {} {}.", ("dark", "stormy", "night")) expected = "It was a dark and stormy night." assert actual == expected
def testmerge(): actual = merge('I the {} and {} {}', ['smart', 'cute', 'joudi']) expected = "I the smart and cute joudi" assert expected == actual