code: def test_random_tr_throws_error_when_rank_first_last_elem_not_equal():
      rank = [2, 3]
      shape = [1, 2, 3]
      with pytest.raises(ValueError) as e:
          ivy.random_tr(shape, rank)
      assert e.value.args
  
imports: import pytest
  from hypothesis import strategies
  import numpy
  import ivy
  import ivy_tests.test_ivy.helpers
  from ivy_tests.test_ivy.helpers import handle_test
label_desc: Use image node_id 19 for calling a global function with example usage: test_random_tr_throws_error_when_rank_first_last_elem_not_equal() without return types