예제 #1
0
 def test_whitespaceDoesntDepleteErasers(self):
     p = Pencil(length=40, pointDurability=1000, eraserDurability=5)
     p.write("last on last night's schedule was immigration law")
     p.erase(" was ")
     self.assertTrue(
         p.getText() == "last on last night's schedule     immigration law")
     p.erase("la")
     self.assertTrue(
         p.getText() == "last on last night's schedule     immigration   w")
예제 #2
0
 def test_erasersWearOut(self):
     p = Pencil(length=40, pointDurability=1000, eraserDurability=2)
     p.write("last on last night's schedule was immigration law")
     p.erase("la")
     self.assertTrue(
         p.getText() == "last on last night's schedule was immigration   w")
     p.erase("la")
     self.assertTrue(
         p.getText() == "last on last night's schedule was immigration   w")
예제 #3
0
 def test_erasingTextReplacesItsLastOccurrenceWithSpaces(self):
     p = Pencil(length=40, pointDurability=1000, eraserDurability=200)
     p.write("last on last night's schedule was immigration law")
     p.erase("la")
     self.assertTrue(
         p.getText() == "last on last night's schedule was immigration   w")
     p.erase("la")
     self.assertTrue(
         p.getText() == "last on   st night's schedule was immigration   w")
예제 #4
0
 def test_editingMarksCollisionsWithNonSpaceWithAt(self):
     p = Pencil(length=40, pointDurability=1000, eraserDurability=200)
     p.write("An apple a day keeps the doctor away")
     p.erase("apple")
     p.overwrite("artichoke")
     self.assertTrue(p.getText() == "An artich@k@ay keeps the doctor away")
예제 #5
0
 def test_editingOverwritesErasedText(self):
     p = Pencil(length=40, pointDurability=1000, eraserDurability=200)
     p.write("An apple a day keeps the doctor away")
     p.erase("apple")
     p.overwrite("onion")
     self.assertTrue(p.getText() == "An onion a day keeps the doctor away")
예제 #6
0
 def test_aPencilWithSufficientlyDurablePointCanWrite(self):
     p = Pencil(length=40, pointDurability=1000, eraserDurability=200)
     text = "Four score and seven years ago"
     p.write(text)
     self.assertTrue(p.getText() == text)
예제 #7
0
 def test_textIsErasedFromTheRight(self):
     p = Pencil(length=40, pointDurability=1000, eraserDurability=5)
     p.write("a Kafkaesque bureaucracy")
     p.erase("Kafkaesque")
     self.assertTrue(p.getText() == "a Kafka      bureaucracy")
예제 #8
0
 def test_aSharpenedPencilCanWriteAgain(self):
     p = Pencil(length=40, pointDurability=4, eraserDurability=200)
     p.write("ambi")
     p.sharpen()
     p.write("dextrous")
     self.assertTrue(p.getText() == "ambidext    ")
예제 #9
0
 def test_aPencilWritesBlanksAfterPointLosesDurability(self):
     p = Pencil(length=40, pointDurability=4, eraserDurability=200)
     p.write("ambidextrous")
     self.assertTrue(p.getText() == "ambi        ")