# Path: yithlibraryserver/locale.py
#     HAS_BABEL = True
#     HAS_BABEL = False
# class DatesFormatter(object):
#     def __init__(self, locale_name):
#     def date(self, date_value):
#     def datetime(self, datetime_value):


import datetime
import unittest
from yithlibraryserver import locale
#
# Yith Library Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Yith Library Server is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Yith Library Server.  If not, see <http://www.gnu.org/licenses/>.




class DatesFormatterTests(unittest.TestCase):

    def test_date(self):
        df_en = locale.DatesFormatter('en')
        df_es = locale.DatesFormatter('es')

        date = datetime.date(2012, 12, 12)

        if locale.HAS_BABEL:
            self.assertEqual(df_en.date(date), 'Dec 12, 2012')
            self.assertEqual(df_es.date(date), '12/12/2012')

        locale_changed = False

# Path: yithlibraryserver/locale.py
#     HAS_BABEL = True
#     HAS_BABEL = False
# class DatesFormatter(object):
#     def __init__(self, locale_name):
#     def date(self, date_value):
#     def datetime(self, datetime_value):


# Path: yithlibraryserver/tests/test_locale.py
import datetime
import unittest
from yithlibraryserver import locale

#
# Yith Library Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Yith Library Server is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Yith Library Server.  If not, see <http://www.gnu.org/licenses/>.




class DatesFormatterTests(unittest.TestCase):

    def test_date(self):
        df_en = locale.DatesFormatter('en')
        df_es = locale.DatesFormatter('es')

        date = datetime.date(2012, 12, 12)

        if locale.HAS_BABEL:
            self.assertEqual(df_en.date(date), 'Dec 12, 2012')
            self.assertEqual(df_es.date(date), '12/12/2012')

        locale_changed = False

        if locale.HAS_BABEL: