<commit_before>from test.integration.base import DBTIntegrationTest, use_profile

import json


class BasePersistDocsTest(DBTIntegrationTest):
    @property
    def schema(self):
        return "persist_docs_060"

    @property
    def models(self):
        return "models"

    def _assert_common_comments(self, *comments):
        for comment in comments:
            assert '"with double quotes"' in comment
            assert """'''abc123'''""" in comment
            assert '\n' in comment
            assert 'Some $lbl$ labeled $lbl$ and $$ unlabeled $$ dollar-quoting' in comment
            assert '/* comment */' in comment
            assert '--\n' in comment

    def _assert_has_table_comments(self, table_node):
        table_comment = table_node['metadata']['comment']
        assert table_comment.startswith('Table model description')

        table_id_comment = table_node['columns']['id']['comment']
        assert table_id_comment.startswith('id Column description')

        table_name_comment = table_node['columns']['name']['comment']
        assert table_name_comment.startswith('Some stuff here and then a call to')

        self._assert_common_comments(
            table_comment, table_id_comment, table_name_comment
        )

    def _assert_has_view_comments(self, view_node, has_node_comments=True, has_column_comments=True):<commit_msg>On windows, docs now include their original carriage returns before newlines<commit_after>from test.integration.base import DBTIntegrationTest, use_profile
import os

import json


class BasePersistDocsTest(DBTIntegrationTest):
    @property
    def schema(self):
        return "persist_docs_060"

    @property
    def models(self):
        return "models"

    def _assert_common_comments(self, *comments):
        for comment in comments:
            assert '"with double quotes"' in comment
            assert """'''abc123'''""" in comment
            assert '\n' in comment
            assert 'Some $lbl$ labeled $lbl$ and $$ unlabeled $$ dollar-quoting' in comment
            assert '/* comment */' in comment
            if os.name == 'nt':
                assert '--\r\n' in comment or '--\n' in comment
            else:
                assert '--\n' in comment

    def _assert_has_table_comments(self, table_node):
        table_comment = table_node['metadata']['comment']
        assert table_comment.startswith('Table model description')

        table_id_comment = table_node['columns']['id']['comment']
        assert table_id_comment.startswith('id Column description')

        table_name_comment = table_node['columns']['name']['comment']
        assert table_name_comment.startswith('Some stuff here and then a call to')

        self._assert_common_comments(
            table_comment, table_id_comment, table_name_comment
        )

    def _assert_has_view_comments(self, view_node, has_node_comments=True, has_column_comments=True):
{'fraction_non_alphanumeric': 0.09887102292165584, 'fraction_numerical': 0.004105371193978789, 'mean_word_length': 3.0386740331491713, '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': '6344321', 'n_tokens_mistral': 811, 'n_tokens_neox': 779, 'n_words': 209}