<commit_before>import unittest
import typing as tp
from satella.instrumentation.metrics.exporters import json_to_prometheus


class TestExporters(unittest.TestCase):
    def test_prometheus(self):

        a = {'root': {'metric': [{'k': 2, '_': 3, 'm': '"'}, {'k': 4, '_': 6}]}}
        b = json_to_prometheus(a)
        self.assertEqual("""root_metric{k=2, m="\""} 3
root_metric{k=4} 6
""", b)
<commit_msg>fix test for Python 3.5<commit_after>import unittest
import typing as tp
from satella.instrumentation.metrics.exporters import json_to_prometheus


class TestExporters(unittest.TestCase):
    def test_prometheus(self):

        a = {'root': {'metric': [{'k': 2, '_': 3, 'm': '"'}, {'k': 4, '_': 6}]}}
        b = json_to_prometheus(a)
        self.assertTrue(b == """root_metric{k=2, m="\""} 3
root_metric{k=4} 6
""" or b == """root_metric{m="\"", k=2} 3
root_metric{k=4} 6
""")

{'fraction_non_alphanumeric': 0.1986455981941309, 'fraction_numerical': 0.024830699774266364, 'mean_word_length': 4.311377245508982, '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': '5322699', 'n_tokens_mistral': 351, 'n_tokens_neox': 324, 'n_words': 75}