# Path: cjktools/scripts.py
# class Script(Enum):
# class ScriptMapping:
#     def __init__(self, from_script, to_script):
#     def __call__(self, j_string):
# def normalize_ascii(j_string):
# def normalize_kana(j_string):
# def normalize(j_string):
# def get_script(script):
# def compare_kana(j_string_a, j_string_b):
# def contains_script(script, j_string):
# def script_type(char):
# def script_boundaries(j_string):
# def script_types(j_string):
# def unique_kanji(j_string):
# 
# Path: cjktools/scripts.py
# class Script(Enum):
#     Hiragana = 1
#     Katakana = 2
#     Kanji = 3
#     Ascii = 4
#     FullAscii = 5
#     HalfKatakana = 6
#     Unknown = 7


import unittest
from cjktools import scripts
from cjktools.scripts import Script
        """
        Tests the contains_script() method.
        """
        contains_script = scripts.contains_script
        self.assertTrue(contains_script(Script.Hiragana, self.test_script))
        self.assertTrue(contains_script(Script.Kanji, self.test_script))
        self.assertTrue(contains_script(Script.Ascii, self.test_script))
        self.assertTrue(contains_script(Script.Katakana, self.test_script))

        self.assertFalse(contains_script(Script.Ascii, self.test_script[1:]))
        self.assertFalse(contains_script(Script.Kanji, self.test_script[:-1]))

    def test_compare_kana(self):
        """
        Tests the compare_kana() method.
        """
        self.assertEqual(scripts.compare_kana('Aあア亜', 'Aアあ亜'), 0)
        self.assertNotEqual(scripts.compare_kana('あAア亜', 'アあ亜A'),  0)

    def test_normalize_ascii(self):
        """
        Tests that ascii characters are normalized correctly.
        """
        full_width_string = 'ｋｌｉｎｇｏｎｓ　ｏｎ　ｔｈｅ　'\
            'ｓｔａｒｂｏａｒｄ　ｂｏｗ！＠＃＆＊（）？，。；＋＝"'
        half_width_string = 'klingons on the starboard bow!@#&*()?,.;+="'

        self.assertEqual(len(full_width_string), len(half_width_string))

        for full_char, half_char in zip(full_width_string, half_width_string):

# Path: cjktools/scripts.py
# class Script(Enum):
# class ScriptMapping:
#     def __init__(self, from_script, to_script):
#     def __call__(self, j_string):
# def normalize_ascii(j_string):
# def normalize_kana(j_string):
# def normalize(j_string):
# def get_script(script):
# def compare_kana(j_string_a, j_string_b):
# def contains_script(script, j_string):
# def script_type(char):
# def script_boundaries(j_string):
# def script_types(j_string):
# def unique_kanji(j_string):
# 
# Path: cjktools/scripts.py
# class Script(Enum):
#     Hiragana = 1
#     Katakana = 2
#     Kanji = 3
#     Ascii = 4
#     FullAscii = 5
#     HalfKatakana = 6
#     Unknown = 7


# Path: cjktools/tests/test_scripts.py
import unittest
from cjktools import scripts
from cjktools.scripts import Script

        """
        Tests the contains_script() method.
        """
        contains_script = scripts.contains_script
        self.assertTrue(contains_script(Script.Hiragana, self.test_script))
        self.assertTrue(contains_script(Script.Kanji, self.test_script))
        self.assertTrue(contains_script(Script.Ascii, self.test_script))
        self.assertTrue(contains_script(Script.Katakana, self.test_script))

        self.assertFalse(contains_script(Script.Ascii, self.test_script[1:]))
        self.assertFalse(contains_script(Script.Kanji, self.test_script[:-1]))

    def test_compare_kana(self):
        """
        Tests the compare_kana() method.
        """
        self.assertEqual(scripts.compare_kana('Aあア亜', 'Aアあ亜'), 0)
        self.assertNotEqual(scripts.compare_kana('あAア亜', 'アあ亜A'),  0)

    def test_normalize_ascii(self):
        """
        Tests that ascii characters are normalized correctly.
        """
        full_width_string = 'ｋｌｉｎｇｏｎｓ　ｏｎ　ｔｈｅ　'\
            'ｓｔａｒｂｏａｒｄ　ｂｏｗ！＠＃＆＊（）？，。；＋＝"'
        half_width_string = 'klingons on the starboard bow!@#&*()?,.;+="'

        self.assertEqual(len(full_width_string), len(half_width_string))

        for full_char, half_char in zip(full_width_string, half_width_string):

            self.assertEqual(scripts.normalize_ascii(full_char), half_char)