# Path: select_multiple_field/codecs.py
# def decode_csv_to_list(encoded):
#     """
#     Decodes a delimiter separated string to a Python list
#     """
#     delimiter = getattr(
#         settings, 'SELECTMULTIPLEFIELD_DELIMITER', DEFAULT_DELIMITER)
#     if encoded == '':
#         return []
# 
#     decoded = sorted(set(encoded.split(delimiter)))
#     return decoded
# 
# def encode_list_to_csv(decoded):
#     """
#     Encodes a Python list to a delimiter separated string
# 
#     Note: This sorts the list lexicographically
#     """
#     delimiter = getattr(
#         settings, 'SELECTMULTIPLEFIELD_DELIMITER', DEFAULT_DELIMITER)
#     decoded = sorted(set(decoded))
#     return delimiter.join(decoded)


from django.test import SimpleTestCase
from select_multiple_field.codecs import (
    decode_csv_to_list, encode_list_to_csv)
        self.test_list = ['a', 'b', 'c']
        self.test_encoded = 'a,b,c'
        self.wild_delimiter = 'シ'
        self.test_encoded_alt = 'aシbシc'

    def test_decoder(self):
        decoded = decode_csv_to_list(self.test_encoded)
        self.assertEqual(decoded, self.test_list)
        decoded = decode_csv_to_list(self.test_encoded[0:1])
        self.assertEqual(decoded, self.test_list[0:1])

    def test_decoder_on_empty_string(self):
        decoded = decode_csv_to_list('')
        self.assertEqual(decoded, [])

    def test_decoder_on_single_encoded_character(self):
        single_encoded = self.choices[1][0]
        decoded = decode_csv_to_list(single_encoded)
        self.assertEqual(decoded, [single_encoded])

    def test_decoder_deduplicates(self):
        decoded = decode_csv_to_list(self.test_encoded + ',b,c,c')
        self.assertEqual(decoded, self.test_list)

    def test_decoder_delimiter(self):
        with self.settings(SELECTMULTIPLEFIELD_DELIMITER=self.wild_delimiter):
            decoded = decode_csv_to_list(self.test_encoded_alt)
            self.assertEqual(decoded, self.test_list)

    def test_encoder(self):

# Path: select_multiple_field/codecs.py
# def decode_csv_to_list(encoded):
#     """
#     Decodes a delimiter separated string to a Python list
#     """
#     delimiter = getattr(
#         settings, 'SELECTMULTIPLEFIELD_DELIMITER', DEFAULT_DELIMITER)
#     if encoded == '':
#         return []
# 
#     decoded = sorted(set(encoded.split(delimiter)))
#     return decoded
# 
# def encode_list_to_csv(decoded):
#     """
#     Encodes a Python list to a delimiter separated string
# 
#     Note: This sorts the list lexicographically
#     """
#     delimiter = getattr(
#         settings, 'SELECTMULTIPLEFIELD_DELIMITER', DEFAULT_DELIMITER)
#     decoded = sorted(set(decoded))
#     return delimiter.join(decoded)


# Path: test_suite/test_codecs.py
from django.test import SimpleTestCase
from select_multiple_field.codecs import (
    decode_csv_to_list, encode_list_to_csv)

        self.test_list = ['a', 'b', 'c']
        self.test_encoded = 'a,b,c'
        self.wild_delimiter = 'シ'
        self.test_encoded_alt = 'aシbシc'

    def test_decoder(self):
        decoded = decode_csv_to_list(self.test_encoded)
        self.assertEqual(decoded, self.test_list)
        decoded = decode_csv_to_list(self.test_encoded[0:1])
        self.assertEqual(decoded, self.test_list[0:1])

    def test_decoder_on_empty_string(self):
        decoded = decode_csv_to_list('')
        self.assertEqual(decoded, [])

    def test_decoder_on_single_encoded_character(self):
        single_encoded = self.choices[1][0]
        decoded = decode_csv_to_list(single_encoded)
        self.assertEqual(decoded, [single_encoded])

    def test_decoder_deduplicates(self):
        decoded = decode_csv_to_list(self.test_encoded + ',b,c,c')
        self.assertEqual(decoded, self.test_list)

    def test_decoder_delimiter(self):
        with self.settings(SELECTMULTIPLEFIELD_DELIMITER=self.wild_delimiter):
            decoded = decode_csv_to_list(self.test_encoded_alt)
            self.assertEqual(decoded, self.test_list)

    def test_encoder(self):

        encoded = encode_list_to_csv(self.test_list)