<commit_before>import unittest
import tempfile
import uuid
import os

import signac.contrib.formats_network

class ConversionTest(unittest.TestCase):

    def test_get_formats_network(self):
        n = signac.contrib.formats_network.get_formats_network()
        self.assertIsNotNone(n)
        self.assertTrue(len(n) > 0)

    def test_get_conversion_network(self):
        cn = signac.contrib.formats_network.get_conversion_network()
        self.assertIsNotNone(cn)

    def test_convert_with_network(self):
        cn = signac.contrib.formats_network.get_conversion_network()
        self.assertIsNotNone(cn)<commit_msg>Skip conversion tests if networkx is not available.<commit_after>import unittest
import tempfile
import uuid
import os

try:
    import signac.contrib.formats_network
except ImportError:
    NETWORK_X_AVAILABLE = False
else:
    NETWORK_X_AVAILABLE = True

@unittest.skipIf(not NETWORK_X_AVAILABLE, 'networkx not available')
class ConversionTest(unittest.TestCase):

    def test_get_formats_network(self):
        n = signac.contrib.formats_network.get_formats_network()
        self.assertIsNotNone(n)
        self.assertTrue(len(n) > 0)

    def test_get_conversion_network(self):
        cn = signac.contrib.formats_network.get_conversion_network()
        self.assertIsNotNone(cn)

    def test_convert_with_network(self):
        cn = signac.contrib.formats_network.get_conversion_network()
        self.assertIsNotNone(cn)
{'fraction_non_alphanumeric': 0.07909215955983494, 'fraction_numerical': 0.001375515818431912, 'mean_word_length': 4.21505376344086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2099575', 'n_tokens_mistral': 471, 'n_tokens_neox': 455, 'n_words': 77}