code: def test_ranking():
      class DummyMetric(metrics.base.Metric):
          def __init__(self):
              self.value = None
  
          def get(self):
              return self.value
  
          @property
          def bigger_is_better(self):
              return False
  
          def revert(self):
              ...
  
          def update(self):
              ...
  
          def works_with(self):
              ...
  
      class DummyPolicy(bandit.base.Policy):
          def __init__(self):
              super().__init__(reward_obj=DummyMetric())
  
          def _pull(self, arms):
              ...
  
      policy = DummyPolicy()
      policy._rewards[0].value = 0
      policy._rewards[1].value = 1
      policy._rewards[2].value = 2
      assert policy.ranking == [0, 1, 2]
  
      policy._rewards[0].value = 2
      policy._rewards[1].value = 1
      policy._rewards[2].value = 0
      assert policy.ranking == [2, 1, 0]
  
      policy._rewards[0].value = 0
      policy._rewards[1].value = 2
      policy._rewards[2].value = 1
      assert policy.ranking == [0, 2, 1]
  
file_path: river/river/bandit/test_policies.py
imports: from __future__ import annotations
  import copy
  import importlib
  import inspect
  import random
  import gym
  import pytest
  from river import bandit, metrics
  from .test_envs import _iter_envs
label_desc: Use image node_id 1 for calling a global function with example usage: test_ranking() and returns: self, False