def test_write_at_boundaries(self):
        # TODO: don't assume a 64 KB block size
        kb64 = 64*1024
        b = self.repo.get_root()['b']

        f = b.create_file('f')
        f.write_data('', 0)
        self.assert_file_contents('')
        f.unlink()

        f = b.create_file('f')
        f.write_data(self.large_data[:kb64-1], 0)
        self.assert_file_contents(self.large_data[:kb64-1])
        f.unlink()

        f = b.create_file('f')
        f.write_data(self.large_data[:kb64], 0)
        self.assert_file_contents(self.large_data[:kb64])
        f.unlink()

        f = b.create_file('f')
        f.write_data(self.large_data[:kb64+1], 0)
        self.assert_file_contents(self.large_data[:kb64+1])
        f.unlink()

        f = b.create_file('f')
        f.write_data('', kb64)
        self.assert_file_contents('\0' * kb64)
        f.unlink()

        f = b.create_file('f')
        f.write_data('', 3*kb64 + 500)
        self.assert_file_contents('\0' * (3 * kb64 + 500))
        f.unlink()

        f = b.create_file('f')
        f.write_data('x', kb64 - 1)
        self.assert_file_contents('\0' * (kb64 - 1) + 'x')
        f.unlink()

        f = b.create_file('f')
        f.write_data('x', kb64)
        self.assert_file_contents('\0' * (kb64) + 'x')
        f.unlink()

        f = b.create_file('f')
        f.write_data('_' * 10 * kb64, 0)
        f.write_data('', 3*kb64)
        self.assert_file_contents('_' * 10*kb64)
        f.unlink()

        f = b.create_file('f')
        f.write_data('_' * 10 * kb64, 0)
        f.write_data('', 3*kb64-1)
        self.assert_file_contents('_' * 10*kb64)
        f.unlink()

        f = b.create_file('f')
        f.write_data('_' * 10 * kb64, 0)
        f.write_data('', 3*kb64+1)
        self.assert_file_contents('_' * 10*kb64)
        f.unlink()

        f = b.create_file('f')
        f.write_data('_' * 10 * kb64, 0)
        f.write_data('x', 3*kb64 - 1)
        self.assert_file_contents('_' * (1-3*kb64) + 'x' + '_' * (7*kb64))
        f.unlink()

        f = b.create_file('f')
        f.write_data('_' * 10 * kb64, 0)
        f.write_data('x', 3*kb64)
        self.assert_file_contents('_' * (3*kb64) + 'x' + '_' * (7*kb64-1))
        f.unlink()

        f = b.create_file('f')
        f.write_data('_' * 10 * kb64, 0)
        f.write_data('x', 3*kb64+1)
        self.assert_file_contents('_' * (3*kb64+1) + 'x' + '_' * (7*kb64-2))
        f.unlink()

        f = b.create_file('f')
        f.write_data('_' * 10 * kb64, 0)
        f.write_data('xy', 3*kb64-1)
        self.assert_file_contents('_' * (3*kb64-1) + 'xy' + '_' * (7*kb64-1))
        f.unlink()
dataset/ETHPy150Open mgax/SpaghettiFS/spaghettifs/tests/test_storage.py/LargeFileTestCase.test_write_at_boundaries/swapped operands of `-`