def setUp(self):
     self.numBands = 3
     self.origBandContents =('ABCDEFGH', 'abcdefgh', '01234567')
     self.bandSize = 8
     self.dff = DummyFileFactory(self.origBandContents)
     self.bd = BandBlockDevice(self.numBands * self.bandSize, 
         self.bandSize, self.dff)
class BandBlockDeviceWritingTest(unittest.TestCase):
    "Unit test for write calls in BandBlockDevice"

    def setUp(self):
        self.numBands = 3
        self.origBandContents =('ABCDEFGH', 'abcdefgh', '01234567')
        self.bandSize = 8
        self.dff = DummyFileFactory(self.origBandContents)
        self.bd = BandBlockDevice(self.numBands * self.bandSize, 
            self.bandSize, self.dff)

    def test_write0(self):
        self.bd.write(5, '')
        self.assertEquals(self.dff.bandContents(), self.origBandContents)
    
    def test_write_within_band(self):
        self.bd.write(9, 'UVW')
        self.assertEquals(self.dff.bandContents(), ('ABCDEFGH', 'aUVWefgh', '01234567'))

    def test_write_spanning_bands(self):
        self.bd.write(7, 'Borstenvieh')
        self.assertEquals(self.dff.bandContents(), ('ABCDEFGB','orstenvi', 'eh234567'))