code: def test_add_half_edge(self):
      embedding = nx.PlanarEmbedding()
      embedding.add_half_edge(0, 1)
      with pytest.raises(
          nx.NetworkXException,
          match="Invalid clockwise reference node.",
      ):
          embedding.add_half_edge(0, 2, cw=3)
      with pytest.raises(
          nx.NetworkXException,
          match="Invalid counterclockwise reference node.",
      ):
          embedding.add_half_edge(0, 2, ccw=3)
      with pytest.raises(
          nx.NetworkXException,
          match="Only one of cw/ccw can be specified.",
      ):
          embedding.add_half_edge(0, 2, cw=1, ccw=1)
      with pytest.raises(
          nx.NetworkXException,
          match=(
              r"Node already has out-half-edge\(s\), either"
              " cw or ccw reference node required."
          ),
      ):
          embedding.add_half_edge(0, 2)
      # these should work
      embedding.add_half_edge(0, 2, cw=1)
      embedding.add_half_edge(0, 3, ccw=1)
      assert sorted(embedding.edges(data=True)) == [
          (0, 1, {"ccw": 2, "cw": 3}),
          (0, 2, {"cw": 1, "ccw": 3}),
          (0, 3, {"cw": 2, "ccw": 1}),
      ]
  
imports: import pytest
  import networkx
  from networkx.algorithms.planarity import check_planarity_recursive, get_counterexample, get_counterexample_recursive
label_desc: Use image node_id 1 for calling the TestPlanarEmbeddingClass obj's underlying member method code with example usage: obj.test_add_half_edge() without return types