Skip to content

Commit

Permalink
Test and fix empty case
Browse files Browse the repository at this point in the history
  • Loading branch information
exarkun committed Nov 28, 2020
1 parent 572a823 commit f5d89b4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
1 change: 0 additions & 1 deletion ExampleGame/examplegame/quiche.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def coinAdded(self, coin):
except StopIteration:
evt = events.Success(
actor=self.thing,
target=obj,
otherMessage=language.Sentence([self.thing, " thumps loudly."]))
else:
evt = events.Success(
Expand Down
23 changes: 23 additions & 0 deletions ExampleGame/examplegame/test/test_quiche.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,29 @@ def testBuyingQuiche(self):
"Vendy thumps loudly and spits out a quiche onto the ground."])


def testEmptyVendingMachinePurchase(self):
"""
Putting 5 coins into an empty vending machine causes it to clunk but does
not cause anything to be spit out.
"""
self._create()
self._drop()
self._open()
for i in range(4):
self._create_quarter("quarter")
self._put_quarter("quarter")

self._create_quarter("quarter")
self._test(
"put quarter in vendy",
["You put quarter in vendy.",
"Vendy thumps loudly.",
],
["Test Player puts quarter in vendy.",
"Vendy thumps loudly."],
)


def testProgrammaticQuichePurchase(self):
location = objects.Thing(store=self.store, name=u"room")
icloc = objects.Container.createFor(location, capacity=500)
Expand Down

0 comments on commit f5d89b4

Please sign in to comment.