<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import tempfile

import six
import pytest

from pyscaffold import utils
from pyscaffold import runner


def test_chdir():
    curr_dir = os.getcwd()
    try:
        temp_dir = tempfile.mkdtemp()
        with utils.chdir(temp_dir):
            new_dir = os.getcwd()
        assert new_dir == temp_dir
        assert curr_dir == os.getcwd()
    finally:
        os.rmdir(temp_dir)


def test_is_valid_identifier():
    bad_names = ["has whitespace",<commit_msg>fix symlink issue on mac os x<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import tempfile

import six
import pytest

from pyscaffold import utils
from pyscaffold import runner


def test_chdir():
    curr_dir = os.getcwd()
    try:
        temp_dir = tempfile.mkdtemp()
        with utils.chdir(temp_dir):
            new_dir = os.getcwd()
        assert new_dir == os.path.realpath(temp_dir)
        assert curr_dir == os.getcwd()
    finally:
        os.rmdir(temp_dir)


def test_is_valid_identifier():
    bad_names = ["has whitespace",
{'fraction_non_alphanumeric': 0.10564663023679417, 'fraction_numerical': 0.0018214936247723133, 'mean_word_length': 2.776632302405498, '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': '616181', 'n_tokens_mistral': 380, 'n_tokens_neox': 388, 'n_words': 93}