def test_displace_and_resize(self): l = self.ws block = RecBlock(self.layout, False, 0, 0, 8, 8) block.displace_and_resize(4, -4) block = RecBlock(self.layout, False, 0, 0, 8, 8) self.assertEqual(block._virtualize(), [(None, None, None, None, None, None, None, None), (None, None, None, None, None, None, None, None), (None, None, None, None, None, None, None, None), (None, None, None, None, None, None, None, None), (l[0], l[0], l[1], l[1], l[1], l[1], l[1], l[1]), (l[0], l[0], l[2], None, l[3], l[3], l[3], l[3]), (l[4], l[4], l[4], l[4], l[3], l[3], l[3], l[3]), (l[4], l[4], l[4], l[4], l[5], l[5], l[5], l[5])]) block.displace_and_resize(-2, 2) block = RecBlock(self.layout, False, 0, 0, 8, 8) self.assertEqual(block._virtualize(), [(None, None, None, None, None, None, None, None), (None, None, None, None, None, None, None, None), (l[0], l[0], l[1], l[1], l[1], l[1], l[1], l[1]), (l[0], l[0], l[1], l[1], l[1], l[1], l[1], l[1]), (l[0], l[0], l[2], None, l[3], l[3], l[3], l[3]), (l[0], l[0], l[2], None, l[3], l[3], l[3], l[3]), (l[4], l[4], l[4], l[4], l[3], l[3], l[3], l[3]), (l[4], l[4], l[4], l[4], l[5], l[5], l[5], l[5])])
def test_shrink_failure(self): block = RecBlock(self.layout, False, 0, 0, 8, 8) with self.assertRaises(SplitLimitException): block.displace_and_resize(0, -5)