<commit_before>import unittest
import networkx as nx
try:
    from unittest.mock import Mock
except ImportError:
    from mock import Mock,patch
import yann.utils.graph as util_graph
from os.path import isfile
from os import remove
class TestGraph(unittest.TestCase):

    def setUp(self):
        self.G = nx.Graph()

    def test_draw_network(self):
        util_graph.draw_network(self.G, "test.pdf", verbose=3)
        self.assertTrue(isfile("test.pdf"))
        remove("test.pdf")
<commit_msg>Edited the graph testcases and prevented it froms aving<commit_after>import unittest
import networkx as nx
try:
    from unittest.mock import Mock
except ImportError:
    from mock import Mock,patch
import yann.utils.graph as util_graph
from os.path import isfile
from os import remove
class TestGraph(unittest.TestCase):

    def setUp(self):
        self.G = nx.Graph()
    @patch('yann.utils.graph.to_pydot')
    def test_draw_network(self, mock_pydot):
        mock_pydot_obj = mock_pydotplus()
        mock_pydot.return_value = mock_pydot_obj
        util_graph.draw_network(self.G, "test.pdf", verbose=3)
        print(mock_pydot_obj.called)
        print()
        self.assertEqual(mock_pydot_obj.called, 3)
        self.assertEqual(mock_pydot_obj.filename, "test.pdf")

class mock_pydotplus:
    called = 0
    filename =''
    def write_png(self, filename):
        self.filename=filename
        self.called += 1
        return True

    def set_node_defaults(self, style="filled", fillcolor="grey"):
        self.called += 1
        return self
    def set_edge_defaults(self,color="blue", arrowhead="vee", weight="0"):
        self.called += 1
        return self
{'fraction_non_alphanumeric': 0.09322524609148813, 'fraction_numerical': 0.004632310364794441, 'mean_word_length': 2.891891891891892, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3276834', 'n_tokens_mistral': 562, 'n_tokens_neox': 536, 'n_words': 131}