# Path: cjktools/alternations.py
# def canonical_forms(kana_segments):
# def canonical_segment_forms(segment, left_context=True, right_context=True):
# def surface_forms(reading_segments):
# def rendaku_variants(kana_segment):
# def onbin_variants(kana_segment):
# def _create_voicing_map():
# def insert_duplicate_kanji(kanji_string):
# def expand_long_vowels(kana_string):


import unittest
import doctest
from cjktools import alternations
from itertools import product
        for i, e in zip(long_vowels, expected):
            out = alternations.expand_long_vowels(i)
            self.assertEqual(out, e)


class AlternationsTestCaseKatagana(unittest.TestCase):
    # Can probably get more clever about this by parameterizing
    def test_canonical_forms(self):
        base = ('ユッ', 'グリ')
        seg1Cases = ['ユ' + c for c in 'イチリキツクッ']
        seg2Cases = ['クリ', 'グリ']
        expected = set(product(seg1Cases, seg2Cases))

        self.assertEqual(set(alternations.canonical_forms(base)), expected)

    def test_canonical_segment_forms(self):
        voiced = 'バリ'
        expected = set(['バリ', 'ハリ'])
        result = set(alternations.canonical_segment_forms(voiced, True, False))
        self.assertEqual(result, expected)

        self.assertEqual(alternations.canonical_segment_forms('ワ'),
                         set(['ワ']))

    def test_canonical_segment_forms_doubling(self):
        doubled = 'サッ'

        actual = alternations.canonical_segment_forms(doubled, True, True)
        expected = {'サイ', 'サキ', 'サク', 'サチ', 'サッ', 'サツ', 'サリ'}


# Path: cjktools/alternations.py
# def canonical_forms(kana_segments):
# def canonical_segment_forms(segment, left_context=True, right_context=True):
# def surface_forms(reading_segments):
# def rendaku_variants(kana_segment):
# def onbin_variants(kana_segment):
# def _create_voicing_map():
# def insert_duplicate_kanji(kanji_string):
# def expand_long_vowels(kana_string):


# Path: cjktools/tests/test_alternations.py
import unittest
import doctest
from cjktools import alternations
from itertools import product

        for i, e in zip(long_vowels, expected):
            out = alternations.expand_long_vowels(i)
            self.assertEqual(out, e)


class AlternationsTestCaseKatagana(unittest.TestCase):
    # Can probably get more clever about this by parameterizing
    def test_canonical_forms(self):
        base = ('ユッ', 'グリ')
        seg1Cases = ['ユ' + c for c in 'イチリキツクッ']
        seg2Cases = ['クリ', 'グリ']
        expected = set(product(seg1Cases, seg2Cases))

        self.assertEqual(set(alternations.canonical_forms(base)), expected)

    def test_canonical_segment_forms(self):
        voiced = 'バリ'
        expected = set(['バリ', 'ハリ'])
        result = set(alternations.canonical_segment_forms(voiced, True, False))
        self.assertEqual(result, expected)

        self.assertEqual(alternations.canonical_segment_forms('ワ'),
                         set(['ワ']))

    def test_canonical_segment_forms_doubling(self):
        doubled = 'サッ'

        actual = alternations.canonical_segment_forms(doubled, True, True)
        expected = {'サイ', 'サキ', 'サク', 'サチ', 'サッ', 'サツ', 'サリ'}


        self.assertEqual(actual, expected)