# Path: preimage/utils/alphabet.py
# class Alphabet:
# def get_n_gram_to_index(alphabet, n):
# def get_index_to_n_gram(alphabet, n):
# def get_n_grams(alphabet, n):
# def transform_strings_to_integer_lists(Y, alphabet):
# 
# Path: preimage/exceptions/n_gram.py
# class InvalidNGramLengthError(ValueError):
#     def __init__(self, n, min_n=0):
#         self.n = n
#         self.min_n = min_n
# 
#     def __str__(self):
#         error_message = 'n must be greater than {:d}. Got: n={:d}'.format(self.min_n, self.n)
#         return error_message


import unittest2
import numpy.testing
from preimage.utils import alphabet
from preimage.exceptions.n_gram import InvalidNGramLengthError
    def test_get_two_grams_returns_expected_two_grams(self):
        n_grams = alphabet.get_n_grams(self.a_b_alphabet, n=2)

        numpy.testing.assert_array_equal(n_grams, self.two_grams)

    def test_get_one_gram_to_index_returns_expected_dict(self):
        n_gram_to_index = alphabet.get_n_gram_to_index(self.a_b_alphabet, n=1)

        self.assertDictEqual(n_gram_to_index, self.one_gram_to_index)

    def test_get_two_gram_to_index_returns_expected_dict(self):
        n_gram_to_index = alphabet.get_n_gram_to_index(self.a_b_alphabet, n=2)

        self.assertDictEqual(n_gram_to_index, self.two_gram_to_index)

    def test_n_zero_get_n_gram_to_index_raises_value_error(self):
        with self.assertRaises(InvalidNGramLengthError):
            alphabet.get_n_gram_to_index(self.a_b_alphabet, n=0)

    def test_get_index_to_one_gram_returns_expected_dict(self):
        index_to_n_gram = alphabet.get_index_to_n_gram(self.a_b_alphabet, n=1)

        self.assertDictEqual(index_to_n_gram, self.index_to_one_gram)

    def test_get_index_to_two_gram_returns_expected_dict(self):
        index_to_n_gram = alphabet.get_index_to_n_gram(self.a_b_alphabet, n=1)

        self.assertDictEqual(index_to_n_gram, self.index_to_one_gram)

    def test_n_zero_get_index_to_n_gram_raises_value_error(self):

# Path: preimage/utils/alphabet.py
# class Alphabet:
# def get_n_gram_to_index(alphabet, n):
# def get_index_to_n_gram(alphabet, n):
# def get_n_grams(alphabet, n):
# def transform_strings_to_integer_lists(Y, alphabet):
# 
# Path: preimage/exceptions/n_gram.py
# class InvalidNGramLengthError(ValueError):
#     def __init__(self, n, min_n=0):
#         self.n = n
#         self.min_n = min_n
# 
#     def __str__(self):
#         error_message = 'n must be greater than {:d}. Got: n={:d}'.format(self.min_n, self.n)
#         return error_message


# Path: preimage/tests/utils/test_alphabet.py
import unittest2
import numpy.testing
from preimage.utils import alphabet
from preimage.exceptions.n_gram import InvalidNGramLengthError

    def test_get_two_grams_returns_expected_two_grams(self):
        n_grams = alphabet.get_n_grams(self.a_b_alphabet, n=2)

        numpy.testing.assert_array_equal(n_grams, self.two_grams)

    def test_get_one_gram_to_index_returns_expected_dict(self):
        n_gram_to_index = alphabet.get_n_gram_to_index(self.a_b_alphabet, n=1)

        self.assertDictEqual(n_gram_to_index, self.one_gram_to_index)

    def test_get_two_gram_to_index_returns_expected_dict(self):
        n_gram_to_index = alphabet.get_n_gram_to_index(self.a_b_alphabet, n=2)

        self.assertDictEqual(n_gram_to_index, self.two_gram_to_index)

    def test_n_zero_get_n_gram_to_index_raises_value_error(self):
        with self.assertRaises(InvalidNGramLengthError):
            alphabet.get_n_gram_to_index(self.a_b_alphabet, n=0)

    def test_get_index_to_one_gram_returns_expected_dict(self):
        index_to_n_gram = alphabet.get_index_to_n_gram(self.a_b_alphabet, n=1)

        self.assertDictEqual(index_to_n_gram, self.index_to_one_gram)

    def test_get_index_to_two_gram_returns_expected_dict(self):
        index_to_n_gram = alphabet.get_index_to_n_gram(self.a_b_alphabet, n=1)

        self.assertDictEqual(index_to_n_gram, self.index_to_one_gram)

    def test_n_zero_get_index_to_n_gram_raises_value_error(self):

        with self.assertRaises(InvalidNGramLengthError):