code: def test_generalized_iterators():
      from pybind11_tests import IntPairs
  
      assert list(IntPairs([(1, 2), (3, 4), (0, 5)]).nonzero()) == [
          (1, 2),
          (3, 4),
      ]
      assert list(
          IntPairs([(1, 2), (2, 0), (0, 3), (4, 5)]).nonzero()
      ) == [(1, 2)]
      assert list(IntPairs([(0, 3), (1, 2), (3, 4)]).nonzero()) == []
  
      assert list(
          IntPairs([(1, 2), (3, 4), (0, 5)]).nonzero_keys()
      ) == [1, 3]
      assert list(
          IntPairs([(1, 2), (2, 0), (0, 3), (4, 5)]).nonzero_keys()
      ) == [1]
      assert (
          list(IntPairs([(0, 3), (1, 2), (3, 4)]).nonzero_keys()) == []
      )
  
imports: import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: test_generalized_iterators() without return types