<commit_before>import tempfile
import os

import util
import fs


def create_temp_files(dir, amount=5):
    return [tempfile.mkstemp(dir=dir) for i in range(amount)]


def test_iter():
    try:
        temp_dir = util.maketemp()
        temp_files = create_temp_files(temp_dir)

        p = fs.path(temp_dir)

        assert(i in temp_files for i in p)
        assert(len(list(p)) == len(temp_files))
    finally:
        # Delete files
        for i in temp_files:
            os.close(i[0])
            os.unlink(i[1])
        os.rmdir(temp_dir)
<commit_msg>Cleaned up the iteration test<commit_after>import tempfile
import os

from nose.tools import eq_ as eq

from fs.test.util import maketemp
import fs


def test_iter():
    temp_dir = maketemp()
    temp_files = ['file1', 'file2', 'file3']

    for i in temp_files:
        f = open(os.path.join(temp_dir, i), 'w')
        f.close()

    p = fs.path(temp_dir)

    eq(sorted([str(i) for i in p]), sorted(temp_files))

{'fraction_non_alphanumeric': 0.11487179487179487, 'fraction_numerical': 0.006153846153846154, 'mean_word_length': 2.711026615969582, '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': '3701073', 'n_tokens_mistral': 354, 'n_tokens_neox': 343, 'n_words': 90}