code: def test_sparse_vector():
      sv = sparse_vector()
      sv.append(pair(3, 0.1))
      sv.append(pair(3, 0.2))
      sv.append(pair(2, 0.3))
      sv.append(pair(1, 0.4))
  
      assert len(sv) == 4
      make_sparse_vector(sv)
  
      assert len(sv) == 3
      assert sv[0].first == 1
      assert sv[0].second == 0.4
      assert sv[1].first == 2
      assert sv[1].second == 0.3
      assert sv[2].first == 3
      assert sv[2].second == approx(0.3)
  
      assert str(sv) == "1: 0.4\n2: 0.3\n3: 0.3"
      assert (
          repr(sv)
          == "< dlib.sparse_vector containing: \n1: 0.4\n2: 0.3\n3: 0.3 >"
      )
  
imports: from dlib import pair, make_sparse_vector, sparse_vector, sparse_vectors, sparse_vectorss
  from pytest import approx
label_desc: Use image node_id 2 for calling a global function with example usage: test_sparse_vector() without return types