code: def test_work_with_empty_index():
      hnsw = Hnsw()
      with pytest.raises(HnswException):
          hnsw.get_nearest([], 1, 1)
      with pytest.raises(HnswException):
          hnsw.save("index")
  
imports: from __future__ import print_function
  import pytest
  import os
  import numpy
  import yatest.common
  import struct
  from hnsw import EVectorComponentType, EDistance, Pool, Hnsw, HnswException, transform_mobius, HnswEstimator, OnlineHnsw
label_desc: Use image node_id 4 for calling a global function with example usage: test_work_with_empty_index() without return types