<commit_before># Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.

from test_case import TestCase

class TestGfm(TestCase):
    def test_fenced_code(self):
        self.assert_renders("""
        <div class="highlight"><pre>foo
        </pre></div>
        """, """
        ```
        foo
        ```
        """, ['gfm'])

    def test_nl2br(self):
        self.assert_renders("""
        <p>foo<br />
        bar</p>
        """, """
        foo
        bar
        """, ['gfm'])

    def test_smart_emphasis(self):
        self.assert_renders("""
        <p>foo__bar__baz</p>
        """, """
        foo__bar__baz
        """, ['gfm'])

    def test_table(self):
        self.assert_renders("""
        <table>
        <thead><commit_msg>fix TestGFM.test_fenced_code to use has_pygments<commit_after># Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.

from test_case import TestCase

class TestGfm(TestCase):
    def test_fenced_code(self):
        test_text = """
        ```
        foo
        ```
        """
        extensions = ['gfm']
        if self.has_pygments:
            self.assert_renders("""
        <div class="highlight"><pre>foo
        </pre></div>
        """, test_text, extensions)
        else:
            self.assert_renders("""
        <pre class="highlight"><code>foo</code></pre>
        """, test_text, extensions)
            

    def test_nl2br(self):
        self.assert_renders("""
        <p>foo<br />
        bar</p>
        """, """
        foo
        bar
        """, ['gfm'])

    def test_smart_emphasis(self):
        self.assert_renders("""
        <p>foo__bar__baz</p>
        """, """
        foo__bar__baz
        """, ['gfm'])

    def test_table(self):
        self.assert_renders("""
        <table>
        <thead>
{'fraction_non_alphanumeric': 0.1413562559694365, 'fraction_numerical': 0.004775549188156638, 'mean_word_length': 1.9590395480225988, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '1257449', 'n_tokens_mistral': 668, 'n_tokens_neox': 638, 'n_words': 155}