def test_WriteAddsStringToContent():
    testString = "string"
    paper = Paper()
    pencil = Pencil(25, 0)

    paper.write(testString, pencil)

    assert paper.content == testString
def test_dullPencilOnlyAddsWhitespace():
    pencil = Pencil(5, 0)
    paper = Paper()
    testString = "Bow wow"
    expectedString = "Bow w  "

    paper.write(testString, pencil)

    assert paper.content == expectedString
def test_eraseStringRemovesLastInstanceOfStringFromContent():
    pencil = Pencil(25, 0)
    paper = Paper()
    testString = "taco taco taco"
    expectedString = "taco taco     "
    paper.write(testString, pencil)

    paper.erase("taco")

    assert paper.content == expectedString
def test_WriteAppendsStringToContent():
    testOne = "test"
    testTwo = " two"
    paper = Paper()
    pencil = Pencil(25, 0)

    paper.write(testOne, pencil)
    paper.write(testTwo, pencil)

    assert paper.content == F"{testOne}{testTwo}"
Exemplo n.º 5
0
selection = ""

while exit != "y":
    system('clear')
    print(F"Your Paper Shows: {paper.content}")
    print(
        F"Your Pencil Point is {pencil.durability} and Length of {pencil.length}"
    )
    selection = input(
        "Do you want to <write>, <sharpen>, or <erase>? Type in your answer: ")
    print()
    print()

    if selection == "write":
        writing = input("Type in what you want to write: ")
        paper.write(writing, pencil)
        print(F"Your Paper Shows: {paper.content}")
        print()
    elif selection == "sharpen":
        pencil.sharpen()
        print(
            F"Your Pencil Point is {pencil.durability} and Length of {pencil.length}"
        )
        print()
    elif selection == "erase":
        erasure = input("What do you want to erase? ")
        paper.erase(erasure)
        print(F"Your Paper Shows: {paper.content}")
        print()

    exit = input("Do you want to exit, y or n? ")