Beispiel #1
0
    def testPersonWearsPantsAndFailsAtPuttingOnUnderpants(self):
        description = self.daisy.visualize()

        iimaginary.IClothingWearer(self.daisy).putOn(
            iimaginary.IClothing(self.dukes))
        self.assertRaises(garments.TooBulky,
                          iimaginary.IClothingWearer(self.daisy).putOn,
                          iimaginary.IClothing(self.undies))
Beispiel #2
0
 def testPersonRemovesPants(self):
     iimaginary.IClothingWearer(self.daisy).putOn(
         iimaginary.IClothing(self.dukes))
     iimaginary.IClothingWearer(self.daisy).takeOff(
         iimaginary.IClothing(self.dukes))
     description = self.daisy.visualize()
     self.assertEquals(
         self.flatten(description.plaintext(self.observer)), u'[ daisy ]\n'
         u'daisy is great.\n'
         u'She is naked.\n'
         u'a pair of Daisy Dukes')
     self.assertIdentical(self.dukes.location, self.daisy)
Beispiel #3
0
    def testPersonWearsUnderpantsAndPants(self):
        description = self.daisy.visualize()

        iimaginary.IClothingWearer(self.daisy).putOn(
            iimaginary.IClothing(self.undies))
        iimaginary.IClothingWearer(self.daisy).putOn(
            iimaginary.IClothing(self.dukes))

        self.assertEquals(
            self.flatten(description.plaintext(self.observer)), u"[ daisy ]\n"
            u"daisy is great.\n"
            u"She is wearing a pair of Daisy Dukes.")
Beispiel #4
0
 def testPersonRemovesPants(self):
     iimaginary.IClothingWearer(self.mannequin).putOn(
         iimaginary.IClothing(self.underwear))
     iimaginary.IClothingWearer(self.mannequin).takeOff(
         iimaginary.IClothing(self.underwear))
     description = self.visualizeMannequin()
     self.assertEquals(
         self.flatten(description.plaintext(self.observer)),
         u'[ mannequin ]\n'
         u'the mannequin is great.\n'
         u'It is naked.\n'
         u'It is carrying a pair of blue pants.')
     self.assertIdentical(self.underwear.location, self.mannequin)
Beispiel #5
0
    def testPersonWearsUnderpantsAndPants(self):
        iimaginary.IClothingWearer(self.mannequin).putOn(
            iimaginary.IClothing(self.undies))
        iimaginary.IClothingWearer(self.mannequin).putOn(
            iimaginary.IClothing(self.underwear))

        description = self.visualizeMannequin()

        self.assertEquals(
            self.flatten(description.plaintext(self.observer)),
            u"[ mannequin ]\n"
            u"the mannequin is great.\n"
            u"It is wearing a pair of blue pants.")
Beispiel #6
0
    def testTakeOffUnderwearBeforePants(self):
        # TODO - underwear removal skill
        wearer = iimaginary.IClothingWearer(self.mannequin)
        wearer.putOn(iimaginary.IClothing(self.undies))
        wearer.putOn(iimaginary.IClothing(self.underwear))

        self.assertRaises(garments.InaccessibleGarment, wearer.takeOff,
                          iimaginary.IClothing(self.undies))
Beispiel #7
0
    def testPersonWearsPants(self):
        iimaginary.IClothingWearer(self.daisy).putOn(
            iimaginary.IClothing(self.dukes))

        description = self.daisy.visualize()
        self.assertEquals(
            self.flatten(description.plaintext(self.observer)), u'[ daisy ]\n'
            u'daisy is great.\n'
            u'She is wearing a pair of Daisy Dukes.')
Beispiel #8
0
    def test_cantDropSomethingYouAreWearing(self):
        """
        If you're wearing an article of clothing, you should not be able to
        drop it until you first take it off.  After taking it off, however, you
        can move it around just fine.
        """
        wearer = iimaginary.IClothingWearer(self.mannequin)
        wearer.putOn(iimaginary.IClothing(self.undies))
        af = self.assertRaises(ActionFailure, self.undies.moveTo,
                               self.mannequin.location)
        self.assertEquals(
            u''.join(af.event.plaintext(self.mannequin)),
            u"You can't move the pair of polka dot underwear "
            u"without removing it first.\n")

        wearer.takeOff(iimaginary.IClothing(self.undies))
        self.undies.moveTo(self.mannequin.location)
        self.assertEquals(self.mannequin.location, self.undies.location)
Beispiel #9
0
 def testPersonIsAWearer(self):
     self.failUnless(
         iimaginary.IClothingWearer.providedBy(
             iimaginary.IClothingWearer(self.mannequin)))
Beispiel #10
0
 def testPersonWearsPantsAndFailsAtPuttingOnUnderpants(self):
     iimaginary.IClothingWearer(self.mannequin).putOn(
         iimaginary.IClothing(self.underwear))
     self.assertRaises(garments.TooBulky,
                       iimaginary.IClothingWearer(self.mannequin).putOn,
                       iimaginary.IClothing(self.undies))
Beispiel #11
0
 def testWornClothingIsFindable(self):
     iimaginary.IClothingWearer(self.daisy).putOn(
         iimaginary.IClothing(self.dukes))
     dukes = list(self.daisy.findProviders(iimaginary.IClothing, 0))
     self.assertEquals(len(dukes), 1)
     self.assertIdentical(dukes[0].thing, self.dukes)