def test_unfilledPrecompiledSlot(self): """ Flattening a L{_PrecompiledSlot} for which no value has been supplied results in an L{FlattenerError} exception. """ tag = oldPrecompile(div[slot("foo")]) self.assertRaises(FlattenerError, self.flatten, tag)
def test_precompiledSlotTagAttribute(self): """ A L{_PrecompiledSlot} which is the value of an attribute is replaced with the value of the slot with XML attribute quoting applied. """ tag = invisible[oldPrecompile(div(foo=slot("foo")))] tag.fillSlots("foo", '"&<>') self.assertStringEqual(self.flatten(tag), '<div foo=""&<>"></div>')
def test_precompiledSlot(self): """ A L{_PrecompiledSlot} is replaced with the value of that slot when flattened. """ tag = invisible[oldPrecompile(div[slot("foo")])] tag.fillSlots("foo", '"&<>') self.assertStringEqual(self.flatten(tag), '<div>"&<></div>')
def test_precompiledSlotFilledWithSlot(self): """ A L{_PrecompiledSlot} slot which is filled with another slot is replaced with the value the other slot is filled with. """ tag = invisible[oldPrecompile(div[slot("foo")])] tag.fillSlots("foo", slot("bar")) tag.fillSlots("bar", '"&<>') self.assertStringEqual(self.flatten(tag), '<div>"&<></div>')