code: def test_linear_schedule():
      # increasing schedule
      schedule = LinearSchedule(1, 3, 10)
  
      # the schedule is defined in number of steps to get from 1 to 3 so there are 10 steps
      # the linspace is defined in number of bins between 1 and 3 so theres are 11 bins
      target_values = np.linspace(1, 3, 11)
      for i in range(10):
          # we round to 4 because there is a very small floating point division difference (1e-10)
          assert round(schedule.current_value, 4) == round(
              target_values[i], 4
          )
          schedule.step()
  
      # make sure the value does not change after 10 steps
      for i in range(10):
          assert schedule.current_value == 3
  
      # decreasing schedule
      schedule = LinearSchedule(3, 1, 10)
  
      target_values = np.linspace(3, 1, 11)
      for i in range(10):
          # we round to 4 because there is a very small floating point division difference (1e-10)
          assert round(schedule.current_value, 4) == round(
              target_values[i], 4
          )
          schedule.step()
  
      # make sure the value does not change after 10 steps
      for i in range(10):
          assert schedule.current_value == 1
  
      # constant schedule
      schedule = LinearSchedule(3, 3, 10)
  
      for i in range(10):
          # we round to 4 because there is a very small floating point division difference (1e-10)
          assert round(schedule.current_value, 4) == 3
          schedule.step()
  
file_path: coach/rl_coach/tests/test_schedules.py
imports: import os
  import sys
  from rl_coach.core_types import EnvironmentSteps
  import pytest
  from rl_coach.schedules import LinearSchedule, ConstantSchedule, ExponentialSchedule, PieceWiseSchedule
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: test_linear_schedule() without return types