def test_paperCanAddPencil(): pencil = Pencil(5, 0) paper = Paper() paper.addPencil(pencil) assert paper.pencil is not None
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_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}"
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_PaperExists(): paper = Paper() assert paper is not None
def test_PaperHasEmptyContent(): paper = Paper() result = paper.content assert result is ""
from pencilkatapython.paper import Paper from pencilkatapython.pencil import Pencil from os import system paper = Paper() pencil = Pencil(15, 5) exit = "n" 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}" )