# Path: cjktools/resources/pinyin_table.py
# class PinyinFormatError(Exception):
# class PinyinTable(dict):
# class PinyinSegmenter(object):
#     def __init__(self):
#     def from_hanzi(self, hanzi_string, inline=True, use_tones=True):
#     def from_ascii(self, ascii_pinyin):
#     def strip_tones(self, ascii_pinyin):
#     def _apply_tone(self, syllable, tone):
#     def __init__(self):
#     def segment_pinyin(self, pinyin_string):
#     def is_pinyin(self, symbol_string):
# def normalize(ascii_pinyin):
# def get_pinyin_table():
# def get_pinyin_segmenter():


import unittest
from cjktools.resources import pinyin_table
        # Tests for correct segmentation and tones detection.
        segmenter = pinyin_table.get_pinyin_segmenter()

        self.assertEqual(
            segmenter.segment_pinyin('woshangdaxue'),
            (('wo', 0), ('shang', 0), ('da', 0), ('xue', 0)),
        )
        self.assertEqual(
            segmenter.segment_pinyin('wo1shang2da3xue4'),
            (('wo', 1), ('shang', 2), ('da', 3), ('xue', 4)),
        )
        self.assertEqual(
            segmenter.segment_pinyin('cheng2zhewei2wang2'),
            (('cheng', 2), ('zhe', 0), ('wei', 2), ('wang', 2)),
        )
        self.assertEqual(
            segmenter.segment_pinyin('yi1ge4jin4r'),
            (('yi', 1), ('ge', 4), ('jin', 4), ('er', 0))
        )

        self.assertEqual(
            segmenter.segment_pinyin('yi1lü4xu'),
            (('yi', 1), ('lü', 4), ('xu', 0))
        )

        self.assertEqual(
            segmenter.segment_pinyin('shangqi3bu4'),
            (('shang', 0), ('qi', 3), ('bu', 4))
        )


# Path: cjktools/resources/pinyin_table.py
# class PinyinFormatError(Exception):
# class PinyinTable(dict):
# class PinyinSegmenter(object):
#     def __init__(self):
#     def from_hanzi(self, hanzi_string, inline=True, use_tones=True):
#     def from_ascii(self, ascii_pinyin):
#     def strip_tones(self, ascii_pinyin):
#     def _apply_tone(self, syllable, tone):
#     def __init__(self):
#     def segment_pinyin(self, pinyin_string):
#     def is_pinyin(self, symbol_string):
# def normalize(ascii_pinyin):
# def get_pinyin_table():
# def get_pinyin_segmenter():


# Path: cjktools/tests/resources/test_pinyin_table.py
import unittest
from cjktools.resources import pinyin_table

        # Tests for correct segmentation and tones detection.
        segmenter = pinyin_table.get_pinyin_segmenter()

        self.assertEqual(
            segmenter.segment_pinyin('woshangdaxue'),
            (('wo', 0), ('shang', 0), ('da', 0), ('xue', 0)),
        )
        self.assertEqual(
            segmenter.segment_pinyin('wo1shang2da3xue4'),
            (('wo', 1), ('shang', 2), ('da', 3), ('xue', 4)),
        )
        self.assertEqual(
            segmenter.segment_pinyin('cheng2zhewei2wang2'),
            (('cheng', 2), ('zhe', 0), ('wei', 2), ('wang', 2)),
        )
        self.assertEqual(
            segmenter.segment_pinyin('yi1ge4jin4r'),
            (('yi', 1), ('ge', 4), ('jin', 4), ('er', 0))
        )

        self.assertEqual(
            segmenter.segment_pinyin('yi1lü4xu'),
            (('yi', 1), ('lü', 4), ('xu', 0))
        )

        self.assertEqual(
            segmenter.segment_pinyin('shangqi3bu4'),
            (('shang', 0), ('qi', 3), ('bu', 4))
        )


    @unittest.skip('Known failure: fails with regex segementer')