示例#1
0
def test_write_madlib():
    path = 'assets/madlib.txt'
    madlib = "It was a dark and stormy night."
    write_madlib(path,madlib)
    expected = madlib
    actual = read_template(path)
    assert expected == actual
示例#2
0
def test_read_template_returns_stripped_string_2(get_path):
    actual = read_template(get_path)
    expected = """Make Me A Video Game!

I the {Adjective} and {Adjective} {A First Name} have {Past Tense Verb}{A First Name}'s {Adjective} sister and plan to steal her {Adjective} {Plural Noun}!

What are a {Large Animal} and backpacking {Small Animal} to do? Before you can help {A Girl's Name}, you'll have to collect the {Adjective} {Plural Noun} and {Adjective} {Plural Noun} that open up the {Number 1-50} worlds connected to A {First Name's} Lair. There are {Number} {Plural Noun} and {Number} {Plural Noun} in the game, along with hundreds of other goodies for you to find.
"""
    assert actual == expected
示例#3
0
def test_read_template():
    actual = read_template('assets/file.txt')
    expected = data_string
    assert actual == expected
示例#4
0
def test_read_template_returns_stripped_string():
    actual = read_template("assets/dark_and_stormy_night_template.txt")
    expected = "It was a {Adjective} and {Adjective} {Noun}."
    assert actual == expected
示例#5
0
def test_read_template_raises_exception_with_bad_path():

    with pytest.raises(FileNotFoundError):
        path = "missing.txt"
        read_template(path)
示例#6
0
def testRead():
    expected = open("assets/template.txt",'r').read()
    received = read_template()
    assert expected == received