<commit_before>import sys
import os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')

import unittest
import logging

from tornado.log import app_log as logger
from mock import MagicMock
from core.builder import Builder

class FakeYamlObject(object):
    """Fake Yaml Object

    This object used as mocking yaml and add 'set'
    method to add key, value
    """

    props = {}

    def set(self, key, value):
        self.props[key] = value

    def get(self, key):
        self.props[key]

class TestTyphoon(unittest.TestCase):

    def test_build_env_mock_simple(self):
        """
        Test mock call Builder().env()
        """
        build = Builder()
        build.env = MagicMock(return_value='testing')
        env = build.env('env_test.yml', 'TEST')
        build.env.assert_called_with('env_test.yml', 'TEST')
        self.assertEqual('testing', env)

    def test_build_env_mock_fake_object(self):
        """
        Test mock call builder.env() and return yaml object
        """
        build = Builder()
        yaml = FakeYamlObject()
        yaml.set('key1', 'value1')
        yaml.set('key2', 'value2')

        build.env = MagicMock(return_value=yaml)
        env = build.env('env_test.yml', 'TEST')
        build.env.assert_called_with('env_test.yml', 'TEST')

        # test equal every key should same with yaml object values
        self.assertEqual(env, yaml)
        self.assertEqual(env.get('key1'), yaml.get('key1'))
        self.assertEqual(env.get('key2'), yaml.get('key2'))

        # test if key not exists<commit_msg>Change test builder class name<commit_after>import sys
import os
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../')

import unittest
import logging

from tornado.log import app_log as logger
from mock import MagicMock
from core.builder import Builder

class FakeYamlObject(object):
    """Fake Yaml Object

    This object used as mocking yaml and add 'set'
    method to add key, value
    """

    props = {}

    def set(self, key, value):
        self.props[key] = value

    def get(self, key):
        self.props[key]

class TestBuilder(unittest.TestCase):

    def test_build_env_mock_simple(self):
        """
        Test mock call Builder().env()
        """
        build = Builder()
        build.env = MagicMock(return_value='testing')
        env = build.env('env_test.yml', 'TEST')
        build.env.assert_called_with('env_test.yml', 'TEST')
        self.assertEqual('testing', env)

    def test_build_env_mock_fake_object(self):
        """
        Test mock call builder.env() and return yaml object
        """
        build = Builder()
        yaml = FakeYamlObject()
        yaml.set('key1', 'value1')
        yaml.set('key2', 'value2')

        build.env = MagicMock(return_value=yaml)
        env = build.env('env_test.yml', 'TEST')
        build.env.assert_called_with('env_test.yml', 'TEST')

        # test equal every key should same with yaml object values
        self.assertEqual(env, yaml)
        self.assertEqual(env.get('key1'), yaml.get('key1'))
        self.assertEqual(env.get('key2'), yaml.get('key2'))

        # test if key not exists
{'fraction_non_alphanumeric': 0.12905256531318854, 'fraction_numerical': 0.005036197670758577, 'mean_word_length': 2.69965075669383, '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': '1850025', 'n_tokens_mistral': 995, 'n_tokens_neox': 946, 'n_words': 239}