code: def test_degree_centrality_2(self):
      d = nx.degree_centrality(self.P3)
      exact = {0: 0.5, 1: 1, 2: 0.5}
      for n, dc in d.items():
          assert exact[n] == pytest.approx(dc, abs=1e-7)
  
file_path: networkx/networkx/algorithms/centrality/tests/test_degree_centrality.py
imports: import pytest
  import networkx
label_desc: Use image node_id 3 for calling the TestDegreeCentrality obj's underlying member method code with example usage: obj.test_degree_centrality_2() without return types