def testInvalidRange(self): # The correct range accounts for the automatically applied padding (3 blanks # each episode. invalid_range = circular_replay_buffer.invalid_range( cursor=6, replay_capacity=10, stack_size=4, update_horizon=1) correct_invalid_range = [5, 6, 7, 8, 9] self.assertAllClose(correct_invalid_range, invalid_range) invalid_range = circular_replay_buffer.invalid_range( cursor=9, replay_capacity=10, stack_size=4, update_horizon=1) correct_invalid_range = [8, 9, 0, 1, 2] self.assertAllClose(correct_invalid_range, invalid_range) invalid_range = circular_replay_buffer.invalid_range( cursor=0, replay_capacity=10, stack_size=4, update_horizon=1) correct_invalid_range = [9, 0, 1, 2, 3] self.assertAllClose(correct_invalid_range, invalid_range) invalid_range = circular_replay_buffer.invalid_range( cursor=6, replay_capacity=10, stack_size=4, update_horizon=3) correct_invalid_range = [3, 4, 5, 6, 7, 8, 9] self.assertAllClose(correct_invalid_range, invalid_range)
def testInvalidRange(self): # The correct range accounts for the automatically applied padding (3 blanks # each episode. invalid_range = circular_replay_buffer.invalid_range( cursor=6, replay_capacity=10, stack_size=4, update_horizon=1) correct_invalid_range = [5, 6, 7, 8, 9] self.assertAllClose(correct_invalid_range, invalid_range) invalid_range = circular_replay_buffer.invalid_range( cursor=9, replay_capacity=10, stack_size=4, update_horizon=1) correct_invalid_range = [8, 9, 0, 1, 2] self.assertAllClose(correct_invalid_range, invalid_range) invalid_range = circular_replay_buffer.invalid_range( cursor=0, replay_capacity=10, stack_size=4, update_horizon=1) correct_invalid_range = [9, 0, 1, 2, 3] self.assertAllClose(correct_invalid_range, invalid_range) invalid_range = circular_replay_buffer.invalid_range( cursor=6, replay_capacity=10, stack_size=4, update_horizon=3) correct_invalid_range = [3, 4, 5, 6, 7, 8, 9] self.assertAllClose(correct_invalid_range, invalid_range)