<commit_before>"""Test export functions."""
import unittest
import pathlib

from pywal import template
from pywal import util


# Import colors.
COLORS = util.read_file_json("tests/test_files/test_file.json")
COLORS["colors"].update(COLORS["special"])
OUTPUT_DIR = pathlib.Path("/tmp/wal")

util.create_dir("/tmp/wal")


class TestExportColors(unittest.TestCase):
    """Test the export functions."""

    def test_all_templates(self):
        """> Test substitutions in template file."""
        template.export_all(COLORS, OUTPUT_DIR)

        result = pathlib.Path("/tmp/colors.sh").is_file()
        self.assertTrue(result)

        content = pathlib.Path("/tmp/colors.sh").read_text()
        content = content.split("\n")[6]
        self.assertEqual(content, "foreground='#F5F1F4'")

    def test_css_template(self):
        """> Test substitutions in template file (css)."""
        template.export(COLORS, "colors.css", OUTPUT_DIR)

        result = pathlib.Path("/tmp/colors.css").is_file()
        self.assertTrue(result)

        content = pathlib.Path("/tmp/colors.css").read_text()
        content = content.split("\n")[6]
        self.assertEqual(content, "    --background: #1F211E;")


if __name__ == "__main__":
    unittest.main()<commit_msg>tests: Fix tests<commit_after>"""Test export functions."""
import unittest
import pathlib

from pywal import template
from pywal import util


# Import colors.
COLORS = util.read_file_json("tests/test_files/test_file.json")
COLORS["colors"].update(COLORS["special"])
OUTPUT_DIR = pathlib.Path("/tmp/wal")

util.create_dir("/tmp/wal")


class TestExportColors(unittest.TestCase):
    """Test the export functions."""

    def test_all_templates(self):
        """> Test substitutions in template file."""
        template.export_all(COLORS, OUTPUT_DIR)

        result = pathlib.Path("/tmp/wal/colors.sh").is_file()
        self.assertTrue(result)

        content = pathlib.Path("/tmp/wal/colors.sh").read_text()
        content = content.split("\n")[6]
        self.assertEqual(content, "foreground='#F5F1F4'")

    def test_css_template(self):
        """> Test substitutions in template file (css)."""
        template.export(COLORS, "colors.css", OUTPUT_DIR)

        result = pathlib.Path("/tmp/wal/colors.css").is_file()
        self.assertTrue(result)

        content = pathlib.Path("/tmp/wal/colors.css").read_text()
        content = content.split("\n")[6]
        self.assertEqual(content, "    --background: #1F211E;")


if __name__ == "__main__":
    unittest.main()
{'fraction_non_alphanumeric': 0.15557306025994486, 'fraction_numerical': 0.0070894052776683735, 'mean_word_length': 3.4797178130511464, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, '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': '5250131', 'n_tokens_mistral': 802, 'n_tokens_neox': 779, 'n_words': 145}