class_docstr: Unit tests for computing a minimum (or maximum) spanning tree
  using Prim's algorithm.
class_docstr_tok: ["Unit","tests","for","computing","a","minimum","(","or","maximum",")","spanning","tree","using","Prim","'s","algorithm","."]
docstr: Tests that the edges with NaN weights are ignored or
  raise an Error based on ignore_nan is true or false
docstr_tok: ["Tests","that","the","edges","with","NaN","weights","are","ignored","or","raise","an","Error","based","on","ignore_nan","is","true","or","false"]
code: def test_ignore_nan(self):
      """Tests that the edges with NaN weights are ignored or
      raise an Error based on ignore_nan is true or false"""
      H = nx.MultiGraph()
      H.add_edge(1, 2, key=1, weight=float("nan"))
      H.add_edge(1, 2, key=2, weight=3)
      H.add_edge(3, 2, key=1, weight=2)
      H.add_edge(3, 1, key=1, weight=4)
  
      # NaN weight edges are ignored when ignore_nan=True
      mst_edges = nx.minimum_spanning_edges(
          H, algorithm=self.algo, ignore_nan=True
      )
      assert edges_equal(
          [(1, 2, 2, {"weight": 3}), (2, 3, 1, {"weight": 2})],
          list(mst_edges),
      )
  
      # NaN weight edges raise Error when ignore_nan=False
      with pytest.raises(ValueError):
          list(
              nx.minimum_spanning_edges(
                  H, algorithm=self.algo, ignore_nan=False
              )
          )
  
imports: import pytest
  import networkx
  from networkx.utils import edges_equal, nodes_equal
label_desc: Use image node_id 2 for calling the TestPrim obj's underlying member method code with example usage: obj.test_ignore_nan() without return types