code: def test_clear():
      graph = DiGraph()
      graph.add_node(0)
      graph.add_node(1)
      graph.add_edge(0, 1, "foo")
  
      assert 0 in graph
      assert 1 in graph
      assert [(0, 1, {"foo"})] == list(graph.edges)
  
      graph.clear()
  
      assert 0 not in graph
      assert 1 not in graph
      assert [] == list(graph)
      assert [] == list(graph.edges)
  
file_path: baikal/tests/_core/test_digraph.py
imports: import pytest
  from baikal._core.digraph import DiGraph, NodeNotFoundError, CyclicDiGraphError
label_desc: Use image node_id 16 for calling a global function with example usage: test_clear() without return types