# Path: pydatajson/helpers.py
# def title_to_name(title, decode=True, max_len=None, use_complete_words=True):
#     """Convierte un título en un nombre normalizado para generar urls."""
#     # decodifica y pasa a minúsculas
#     if decode:
#         title = unidecode(title)
#     title = title.lower()
# 
#     # remueve caracteres no permitidos
#     filtered_title = re.sub(r'[^a-z0-9- ]+', '', title)
# 
#     # remueve stop words y espacios y une palabras sólo con un "-"
#     normalized_title = '-'.join([word for word in filtered_title.split()
#                                  if word not in STOP_WORDS])
# 
#     # recorto el titulo normalizado si excede la longitud máxima
#     if max_len and len(normalized_title) > max_len:
# 
#         # busco la última palabra completa
#         if use_complete_words:
#             last_word_index = normalized_title.rindex("-", 0, max_len)
#             normalized_title = normalized_title[:last_word_index]
# 
#         # corto en el último caracter
#         else:
#             normalized_title = normalized_title[:max_len]
# 
#     return normalized_title
# 
# Path: tests/context.py



import os
import unittest
from pydatajson.ckan_utils import *
from pydatajson.helpers import title_to_name
from .context import pydatajson
# -*- coding: utf-8 -*-

from __future__ import unicode_literals



SAMPLES_DIR = os.path.join("tests", "samples")


class DatasetConversionTestCase(unittest.TestCase):

    @classmethod
    def get_sample(cls, sample_filename):
        return os.path.join(SAMPLES_DIR, sample_filename)

    @classmethod
    def setUpClass(cls):
        cls.catalog = pydatajson.DataJson(cls.get_sample('full_data.json'))
        cls.catalog_id = cls.catalog.get(

# Path: pydatajson/helpers.py
# def title_to_name(title, decode=True, max_len=None, use_complete_words=True):
#     """Convierte un título en un nombre normalizado para generar urls."""
#     # decodifica y pasa a minúsculas
#     if decode:
#         title = unidecode(title)
#     title = title.lower()
# 
#     # remueve caracteres no permitidos
#     filtered_title = re.sub(r'[^a-z0-9- ]+', '', title)
# 
#     # remueve stop words y espacios y une palabras sólo con un "-"
#     normalized_title = '-'.join([word for word in filtered_title.split()
#                                  if word not in STOP_WORDS])
# 
#     # recorto el titulo normalizado si excede la longitud máxima
#     if max_len and len(normalized_title) > max_len:
# 
#         # busco la última palabra completa
#         if use_complete_words:
#             last_word_index = normalized_title.rindex("-", 0, max_len)
#             normalized_title = normalized_title[:last_word_index]
# 
#         # corto en el último caracter
#         else:
#             normalized_title = normalized_title[:max_len]
# 
#     return normalized_title
# 
# Path: tests/context.py



# Path: tests/test_ckan_utils.py
import os
import unittest
from pydatajson.ckan_utils import *
from pydatajson.helpers import title_to_name
from .context import pydatajson

# -*- coding: utf-8 -*-

from __future__ import unicode_literals



SAMPLES_DIR = os.path.join("tests", "samples")


class DatasetConversionTestCase(unittest.TestCase):

    @classmethod
    def get_sample(cls, sample_filename):
        return os.path.join(SAMPLES_DIR, sample_filename)

    @classmethod
    def setUpClass(cls):
        cls.catalog = pydatajson.DataJson(cls.get_sample('full_data.json'))
        cls.catalog_id = cls.catalog.get(

            'identifier', title_to_name(