<commit_before>import os
import unittest

from maintain.commands.release import bump_version_file
from ..utils import temp_directory, touch


class BumpVersionTestCase(unittest.TestCase):
    def test_doesnt_write_version_file_when_non_existant(self):
        with temp_directory() as directory:
            bump_version_file('2.3.0')
            self.assertFalse(os.path.exists('VERSION'))

    def test_bumps_version_file(self):
        with temp_directory() as directory:
            touch('VERSION', '2.2.12')
            bump_version_file('2.3.0')

            with open('VERSION') as fp:
                self.assertEqual(fp.read(), '2.3.0')<commit_msg>[Version File Releaser] Update tests<commit_after>import os
import unittest

from semantic_version import Version

from maintain.release.version_file import VersionFileReleaser
from ..utils import temp_directory, touch


class BumpVersionTestCase(unittest.TestCase):
    # Detection

    def test_detects_version_file(self):
        with temp_directory() as directory:
            touch('VERSION')
            self.assertTrue(VersionFileReleaser.detect())

    def test_doesnt_detect_without_version_file(self):
        with temp_directory() as directory:
            self.assertFalse(VersionFileReleaser.detect())

    # Determing current version

    def test_determine_current_version(self):
        releaser = VersionFileReleaser()

        with temp_directory() as directory:
            touch('VERSION', '0.2.6')
            version = releaser.determine_current_version()
            self.assertEqual(version, Version('0.2.6'))

    # Bumping

    def test_bumps_version_file(self):
        releaser = VersionFileReleaser()

        with temp_directory() as directory:
            touch('VERSION', '2.2.12')
            releaser.bump('2.3.0')

            with open('VERSION') as fp:
                self.assertEqual(fp.read(), '2.3.0\n')
{'fraction_non_alphanumeric': 0.09936908517350158, 'fraction_numerical': 0.015247108307045216, 'mean_word_length': 2.981171548117155, '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': '4250423', 'n_tokens_mistral': 549, 'n_tokens_neox': 528, 'n_words': 111}