<commit_before># -*- coding: utf-8 -*-
from unittest import skipIf, skipUnless
import six
from django.test import SimpleTestCase
from django_extensions.management.modelviz import generate_graph_data


class ModelVizTests(SimpleTestCase):
    @skipIf(six.PY3, 'FIXME Python 3 renders labels funny, see below')
    def test_generate_graph_data_can_render_label(self):
        app_labels = ['auth']
        data = generate_graph_data(app_labels)

        models = data['graphs'][0]['models']
        user_data = [x for x in models if x['name'] == 'User'][0]
        relation_labels = [x['label'] for x in user_data['relations']]
        self.assertIn("groups (user)", relation_labels)

    @skipUnless(six.PY3, 'DELETEME Python 3 should render the same as Python 2')
    def test_generate_graph_data_formats_labels_as_bytes(self):
        app_labels = ['auth']
        data = generate_graph_data(app_labels)

        models = data['graphs'][0]['models']
        user_data = [x for x in models if x['name'] == 'User'][0]
        relation_labels = [x['label'] for x in user_data['relations']]
        self.assertIn("groups (b'user')", relation_labels)
<commit_msg>Fixed failing tests<commit_after># -*- coding: utf-8 -*-
from unittest import skipIf, skipUnless
import six
from django.test import SimpleTestCase
from django_extensions.management.modelviz import generate_graph_data


class ModelVizTests(SimpleTestCase):
    def test_generate_graph_data_can_render_label(self):
        app_labels = ['auth']
        data = generate_graph_data(app_labels)

        models = data['graphs'][0]['models']
        user_data = [x for x in models if x['name'] == 'User'][0]
        relation_labels = [x['label'] for x in user_data['relations']]
        self.assertIn("groups (user)", relation_labels)

{'fraction_non_alphanumeric': 0.12136465324384788, 'fraction_numerical': 0.00727069351230425, 'mean_word_length': 4.025280898876405, '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': '799938', 'n_tokens_mistral': 546, 'n_tokens_neox': 534, 'n_words': 140}