<commit_before><commit_msg>create test_out.py for qaamus.out.Result testing<commit_after>import unittest
from qaamus.out import Result


class ResultTestCase(unittest.TestCase):

    def test_result_with_none_input(self):
        result = Result()
        self.assertEqual(result.query, None)
        self.assertEqual(result.ara, None)
        self.assertEqual(result.footer, None)

    def test_result_with_result_input(self):
        """query, ara, footer object."""
        result = Result("ind_utama", "ara_utama", "footer")
        self.assertEqual(result.query, "ind_utama")
        self.assertEqual(result.ara, "ara_utama")
        self.assertEqual(result.footer, "footer")

    def test_get_return_tuple(self):
        result = Result("ind_utama", "ara_utama", "footer")
        expected = ("ind_utama", "ara_utama", "footer")
        self.assertEqual(result.utama, expected)

    def test_result_with_result_input_berhubungan(self):
        result = Result(berhubungan=[(1, 2), (3, 4)])
        expected = [(1, 2), (3, 4)]
        self.assertEqual(result.berhubungan, expected)

    def test_result_with_result_input_berhubungan_generator_obj(self):
        result = Result(berhubungan=(x for x in range(4)))
        expected = [0, 1, 2, 3]
        self.assertEqual(result.berhubungan, expected)

    def test_result_with_instruction_arg(self):
        result = Result(instruksi="Ini adalah instruksi")
        expected = 'Ini adalah instruksi'
        self.assertEqual(result.instruksi, expected)
{'fraction_non_alphanumeric': 0.11885790172642763, 'fraction_numerical': 0.008632138114209827, 'mean_word_length': 3.6085626911314983, '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': '1410586', 'n_tokens_mistral': 493, 'n_tokens_neox': 469, 'n_words': 91}