Created
January 21, 2021 00:10
-
-
Save gandarez/a5ec5888eb722ca0f13b5a778361328d to your computer and use it in GitHub Desktop.
Test analyse_text for MIMELexer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pytest | |
from pygments.lexers.mime import MIMELexer | |
@pytest.fixture(scope="module") | |
def lexer(): | |
yield MIMELexer() | |
def _example_file_path(filename): | |
return os.path.join(os.path.dirname(__file__), 'examplefiles', filename) | |
def test_mime_analyse_text(lexer): | |
with open(_example_file_path("MIME_example.eml"), 'rb') as fp: | |
text = fp.read().decode('utf-8') | |
res = lexer.analyse_text(text) | |
assert res == 1.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment