trivial: apply new pre-commit hooks
This commit is contained in:
parent
c53b7a56fc
commit
c7996a8425
|
@ -14,11 +14,10 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from combo.data.models import ConfigJsonCell
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.utils.timezone import now, timedelta
|
from django.utils.timezone import now, timedelta
|
||||||
|
|
||||||
from combo.data.models import ConfigJsonCell
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# combo-plugin-gnm - Combo GNM plugin
|
# combo-plugin-gnm - Combo GNM plugin
|
||||||
# Copyright (C) 2017 Entr'ouvert
|
# Copyright (C) 2017 Entr'ouvert
|
||||||
#
|
#
|
||||||
|
@ -16,13 +15,12 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
from combo.apps.maps.models import MapLayer
|
||||||
|
from combo.data.models import ConfigJsonCell, Page
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.template import Context, Template
|
from django.template import Context, Template
|
||||||
|
|
||||||
from combo.apps.maps.models import MapLayer
|
|
||||||
from combo.data.models import Page, ConfigJsonCell
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
@ -51,9 +49,9 @@ class Command(BaseCommand):
|
||||||
self.stderr.write('error in layer %s: %r\n' % (layer, resp['features']))
|
self.stderr.write('error in layer %s: %r\n' % (layer, resp['features']))
|
||||||
continue
|
continue
|
||||||
for feature in resp['features']:
|
for feature in resp['features']:
|
||||||
cell_parameters = dict(
|
cell_parameters = {
|
||||||
[(x, feature['properties'][x]) for x in feature['properties'] if x in cell_form_keys]
|
x: feature['properties'][x] for x in feature['properties'] if x in cell_form_keys
|
||||||
)
|
}
|
||||||
try:
|
try:
|
||||||
cell = ConfigJsonCell.objects.get(
|
cell = ConfigJsonCell.objects.get(
|
||||||
key=layer.slug, parameters=cell_parameters, page__template_name='place'
|
key=layer.slug, parameters=cell_parameters, page__template_name='place'
|
||||||
|
|
|
@ -14,11 +14,10 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from combo.apps.dashboard.models import Tile
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.utils.timezone import now, timedelta
|
from django.utils.timezone import now, timedelta
|
||||||
|
|
||||||
from combo.apps.dashboard.models import Tile
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
|
|
@ -15,20 +15,19 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import html
|
import html
|
||||||
from io import BytesIO
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
import zipfile
|
import zipfile
|
||||||
|
from io import BytesIO
|
||||||
|
|
||||||
|
from combo.data.models import TextCell
|
||||||
|
from combo.utils import requests
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.core.files.storage import default_storage
|
from django.core.files.storage import default_storage
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
|
|
||||||
from combo.data.models import TextCell
|
|
||||||
from combo.utils import requests
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ class Command(BaseCommand):
|
||||||
"cache_duration": 60,
|
"cache_duration": 60,
|
||||||
"force_async": False,
|
"force_async": False,
|
||||||
"name": "M'y rendre",
|
"name": "M'y rendre",
|
||||||
"loading-message": u'Calcul…',
|
"loading-message": 'Calcul…',
|
||||||
"varnames": ["lat1", "lng1", "lat2", "lng2", "date", "to"],
|
"varnames": ["lat1", "lng1", "lat2", "lng2", "date", "to"],
|
||||||
"form": [
|
"form": [
|
||||||
{
|
{
|
||||||
|
@ -572,14 +572,14 @@ class Command(BaseCommand):
|
||||||
}
|
}
|
||||||
|
|
||||||
PRODUCER_LABELS = {
|
PRODUCER_LABELS = {
|
||||||
'atmo': u'ATMO Auvergne Rhône-Alpes',
|
'atmo': 'ATMO Auvergne Rhône-Alpes',
|
||||||
'rnsa': u'RNSA',
|
'rnsa': 'RNSA',
|
||||||
'onlymoov': u'ONLY MOOV',
|
'onlymoov': 'ONLY MOOV',
|
||||||
'tcl': u'TCL',
|
'tcl': 'TCL',
|
||||||
'toodego': u'Toodego',
|
'toodego': 'Toodego',
|
||||||
'velov': "Velo'v",
|
'velov': "Velo'v",
|
||||||
'vivrou': "Vivro",
|
'vivrou': "Vivro",
|
||||||
'grandlyon': u'Grand Lyon',
|
'grandlyon': 'Grand Lyon',
|
||||||
'bluely': "Bluely",
|
'bluely': "Bluely",
|
||||||
'citiz-lpa': "Citiz LPA",
|
'citiz-lpa': "Citiz LPA",
|
||||||
'sncf': "SNCF",
|
'sncf': "SNCF",
|
||||||
|
@ -659,12 +659,12 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
COMBO_ASSET_SLOTS = self.settings_json.get('COMBO_ASSET_SLOTS.update') or {}
|
COMBO_ASSET_SLOTS = self.settings_json.get('COMBO_ASSET_SLOTS.update') or {}
|
||||||
for producer, producer_label in PRODUCER_LABELS.items():
|
for producer, producer_label in PRODUCER_LABELS.items():
|
||||||
COMBO_ASSET_SLOTS['logo:%s' % producer] = {'label': u'Logo %s' % producer_label}
|
COMBO_ASSET_SLOTS['logo:%s' % producer] = {'label': 'Logo %s' % producer_label}
|
||||||
|
|
||||||
# add lyon as used by cart@ds
|
# add lyon as used by cart@ds
|
||||||
for arrondissement in ['1er'] + ['%seme' % x for x in range(2, 10)]:
|
for arrondissement in ['1er'] + ['%seme' % x for x in range(2, 10)]:
|
||||||
COMBO_ASSET_SLOTS['logo:lyon-%s' % arrondissement] = {
|
COMBO_ASSET_SLOTS['logo:lyon-%s' % arrondissement] = {
|
||||||
'label': u'Logo Lyon %s' % arrondissement,
|
'label': 'Logo Lyon %s' % arrondissement,
|
||||||
}
|
}
|
||||||
|
|
||||||
tiles = [
|
tiles = [
|
||||||
|
@ -688,7 +688,7 @@ class Command(BaseCommand):
|
||||||
('parc-velo', "Parc vélo"),
|
('parc-velo', "Parc vélo"),
|
||||||
('piscine', "Piscine"),
|
('piscine', "Piscine"),
|
||||||
('pollen', "Pollen"),
|
('pollen', "Pollen"),
|
||||||
('silo-a-verre', u'Silo à verre'),
|
('silo-a-verre', 'Silo à verre'),
|
||||||
('taxi', "Taxi"),
|
('taxi', "Taxi"),
|
||||||
('tcl', "TCL"),
|
('tcl', "TCL"),
|
||||||
('velov', "Velo'v"),
|
('velov', "Velo'v"),
|
||||||
|
@ -704,10 +704,10 @@ class Command(BaseCommand):
|
||||||
]
|
]
|
||||||
|
|
||||||
for tile, tile_label in tiles:
|
for tile, tile_label in tiles:
|
||||||
COMBO_ASSET_SLOTS['picture:%s' % tile] = {'label': u'Photographie %s' % tile_label}
|
COMBO_ASSET_SLOTS['picture:%s' % tile] = {'label': 'Photographie %s' % tile_label}
|
||||||
if tile not in ('taxi', 'tcl', 'velov'):
|
if tile not in ('taxi', 'tcl', 'velov'):
|
||||||
COMBO_ASSET_SLOTS['picture:banner:%s' % tile] = {
|
COMBO_ASSET_SLOTS['picture:banner:%s' % tile] = {
|
||||||
'label': u'Photographie/bannière %s' % tile_label
|
'label': 'Photographie/bannière %s' % tile_label
|
||||||
}
|
}
|
||||||
|
|
||||||
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
|
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# combo-plugin-gnm - Combo GNM plugin
|
# combo-plugin-gnm - Combo GNM plugin
|
||||||
# Copyright (C) 2017 Entr'ouvert
|
# Copyright (C) 2017 Entr'ouvert
|
||||||
#
|
#
|
||||||
|
@ -15,33 +14,31 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from collections import OrderedDict
|
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import operator
|
import operator
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
from collections import OrderedDict
|
||||||
from pyproj import Geod
|
|
||||||
from requests import RequestException
|
|
||||||
|
|
||||||
from django import template
|
|
||||||
from django.conf import settings
|
|
||||||
from django.core.serializers.json import DjangoJSONEncoder
|
|
||||||
from django.core import signing
|
|
||||||
from django.utils.dateparse import parse_date, parse_datetime
|
|
||||||
from django.utils.http import quote
|
|
||||||
from django.utils.html import format_html
|
|
||||||
from django.utils.text import slugify
|
|
||||||
from django.utils.timezone import now, is_naive, make_aware
|
|
||||||
from django.utils.safestring import mark_safe
|
|
||||||
|
|
||||||
from combo.apps.dashboard.models import DashboardCell, Tile
|
from combo.apps.dashboard.models import DashboardCell, Tile
|
||||||
from combo.apps.maps.models import Map, MapLayer
|
from combo.apps.maps.models import Map, MapLayer
|
||||||
from combo.data.models import Page, CellBase, ConfigJsonCell
|
from combo.data.models import CellBase, ConfigJsonCell, Page
|
||||||
from combo.public.views import render_cell
|
from combo.public.views import render_cell
|
||||||
from combo.utils import requests
|
from combo.utils import requests
|
||||||
|
from django import template
|
||||||
|
from django.conf import settings
|
||||||
|
from django.core import signing
|
||||||
|
from django.core.serializers.json import DjangoJSONEncoder
|
||||||
|
from django.utils.dateparse import parse_date, parse_datetime
|
||||||
|
from django.utils.html import format_html
|
||||||
|
from django.utils.http import quote
|
||||||
|
from django.utils.safestring import mark_safe
|
||||||
|
from django.utils.text import slugify
|
||||||
|
from django.utils.timezone import is_naive, make_aware, now
|
||||||
|
from pyproj import Geod
|
||||||
|
from requests import RequestException
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
@ -62,7 +59,7 @@ EN_FULL_WEEKDAYS_LIST = list(EN_ABBREV_WEEKDAYS.values())
|
||||||
FR_ABBREV_WEEKDAYS_LIST = OrderedDict(zip(EN_ABBREV_WEEKDAYS_LIST, FR_WEEKDAYS))
|
FR_ABBREV_WEEKDAYS_LIST = OrderedDict(zip(EN_ABBREV_WEEKDAYS_LIST, FR_WEEKDAYS))
|
||||||
|
|
||||||
|
|
||||||
class TimeSlot(object):
|
class TimeSlot:
|
||||||
def __init__(self, start, end):
|
def __init__(self, start, end):
|
||||||
if is_naive(start):
|
if is_naive(start):
|
||||||
start = make_aware(start)
|
start = make_aware(start)
|
||||||
|
@ -425,35 +422,35 @@ def as_opening_hours_badge(data):
|
||||||
slots = [x for x in slots if x]
|
slots = [x for x in slots if x]
|
||||||
if not slots:
|
if not slots:
|
||||||
klass = 'closed'
|
klass = 'closed'
|
||||||
label = u'Fermé'
|
label = 'Fermé'
|
||||||
elif base_datetime < slots[0].start:
|
elif base_datetime < slots[0].start:
|
||||||
klass = 'closed'
|
klass = 'closed'
|
||||||
verb = u'Réouvre'
|
verb = 'Réouvre'
|
||||||
if slots[0].start.weekday() == today.weekday():
|
if slots[0].start.weekday() == today.weekday():
|
||||||
day_label = ''
|
day_label = ''
|
||||||
if slots[0].start.hour < 12:
|
if slots[0].start.hour < 12:
|
||||||
verb = 'Ouvre'
|
verb = 'Ouvre'
|
||||||
elif slots[0].start.weekday() == (today.weekday() + 1) % 7:
|
elif slots[0].start.weekday() == (today.weekday() + 1) % 7:
|
||||||
day_label = u'demain'
|
day_label = 'demain'
|
||||||
else:
|
else:
|
||||||
day_label = FR_WEEKDAYS[slots[0].start.weekday()]
|
day_label = FR_WEEKDAYS[slots[0].start.weekday()]
|
||||||
if slots[0].start.strftime("%H:%M") == slots[0].end.strftime("%H:%M") == '00:00':
|
if slots[0].start.strftime("%H:%M") == slots[0].end.strftime("%H:%M") == '00:00':
|
||||||
label = u'%s %s 24h/24' % (verb, day_label)
|
label = '%s %s 24h/24' % (verb, day_label)
|
||||||
else:
|
else:
|
||||||
time = format_time(slots[0].start.hour, slots[0].start.minute)
|
time = format_time(slots[0].start.hour, slots[0].start.minute)
|
||||||
label = u'%s %s à %s' % (verb, day_label, time)
|
label = '%s %s à %s' % (verb, day_label, time)
|
||||||
elif base_datetime < slots[0].end:
|
elif base_datetime < slots[0].end:
|
||||||
if (slots[0].end - base_datetime).seconds < 3600:
|
if (slots[0].end - base_datetime).seconds < 3600:
|
||||||
klass = 'soon-to-be-closed'
|
klass = 'soon-to-be-closed'
|
||||||
else:
|
else:
|
||||||
klass = 'open'
|
klass = 'open'
|
||||||
if slots[0].start.strftime("%H:%M") == slots[0].end.strftime("%H:%M") == '00:00':
|
if slots[0].start.strftime("%H:%M") == slots[0].end.strftime("%H:%M") == '00:00':
|
||||||
label = u"Ouvert 24h/24"
|
label = "Ouvert 24h/24"
|
||||||
else:
|
else:
|
||||||
time = format_time(slots[0].end.hour, slots[0].end.minute)
|
time = format_time(slots[0].end.hour, slots[0].end.minute)
|
||||||
label = u"Ouvert jusqu'à %s" % time
|
label = "Ouvert jusqu'à %s" % time
|
||||||
|
|
||||||
return mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
return mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
|
@ -688,11 +685,11 @@ def get_suggestions(request, user_data, places_data):
|
||||||
address = None
|
address = None
|
||||||
if places_data and places_data.get('data'):
|
if places_data and places_data.get('data'):
|
||||||
place_data = places_data['data'][0]
|
place_data = places_data['data'][0]
|
||||||
address = u'%(adresse)s, %(ville)s, France' % place_data['content']
|
address = '%(adresse)s, %(ville)s, France' % place_data['content']
|
||||||
elif user_data.get('address_street'):
|
elif user_data.get('address_street'):
|
||||||
if not user_data.get('address_number'):
|
if not user_data.get('address_number'):
|
||||||
user_data['address_number'] = ''
|
user_data['address_number'] = ''
|
||||||
address = u'%(address_number)s %(address_street)s, %(address_city)s, France' % user_data
|
address = '%(address_number)s %(address_street)s, %(address_city)s, France' % user_data
|
||||||
|
|
||||||
coords = None
|
coords = None
|
||||||
if address:
|
if address:
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
if not 'combo_plugin_gnm' in INSTALLED_APPS:
|
if not 'combo_plugin_gnm' in INSTALLED_APPS:
|
||||||
INSTALLED_APPS += ('combo_plugin_gnm',)
|
INSTALLED_APPS += ('combo_plugin_gnm',)
|
||||||
TENANT_APPS += ('combo_plugin_gnm',)
|
TENANT_APPS += ('combo_plugin_gnm',)
|
||||||
|
|
|
@ -2,12 +2,17 @@ Source: combo-plugin-gnm
|
||||||
Maintainer: Frederic Peters <fpeters@entrouvert.com>
|
Maintainer: Frederic Peters <fpeters@entrouvert.com>
|
||||||
Section: python
|
Section: python
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Build-Depends: debhelper-compat (= 12), dh-python, python3-all, python3-setuptools, python3-django, python3-dateutil
|
Build-Depends: debhelper-compat (= 12),
|
||||||
|
dh-python,
|
||||||
|
python3-all,
|
||||||
|
python3-dateutil,
|
||||||
|
python3-django,
|
||||||
|
python3-setuptools,
|
||||||
Standards-Version: 3.9.1
|
Standards-Version: 3.9.1
|
||||||
|
|
||||||
Package: python3-combo-plugin-gnm
|
Package: python3-combo-plugin-gnm
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Depends: ${misc:Depends}, ${python:Depends}, python3-combo
|
Depends: python3-combo, ${misc:Depends}, ${python:Depends}
|
||||||
Description: Combo GNM Plugin (Python 3)
|
Description: Combo GNM Plugin (Python 3)
|
||||||
Extension module for the Combo content management system,
|
Extension module for the Combo content management system,
|
||||||
with various developments that are at the moment at least
|
with various developments that are at the moment at least
|
||||||
|
|
11
setup.py
11
setup.py
|
@ -1,17 +1,16 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
from distutils.cmd import Command
|
||||||
from setuptools.command.install_lib import install_lib as _install_lib
|
|
||||||
from distutils.command.build import build as _build
|
from distutils.command.build import build as _build
|
||||||
from distutils.command.sdist import sdist
|
from distutils.command.sdist import sdist
|
||||||
from distutils.cmd import Command
|
|
||||||
from setuptools import setup, find_packages
|
from setuptools import find_packages, setup
|
||||||
|
from setuptools.command.install_lib import install_lib as _install_lib
|
||||||
|
|
||||||
|
|
||||||
class eo_sdist(sdist):
|
class eo_sdist(sdist):
|
||||||
|
@ -28,7 +27,7 @@ class eo_sdist(sdist):
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
if os.path.exists('VERSION'):
|
if os.path.exists('VERSION'):
|
||||||
with open('VERSION', 'r') as v:
|
with open('VERSION') as v:
|
||||||
return v.read()
|
return v.read()
|
||||||
if os.path.exists('.git'):
|
if os.path.exists('.git'):
|
||||||
p = subprocess.Popen(
|
p = subprocess.Popen(
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import pytest
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import pytest
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
from combo_plugin_gnm.templatetags.gnm import as_opening_hours_badge, EN_FULL_WEEKDAYS_LIST, FR_WEEKDAYS
|
from combo_plugin_gnm.templatetags.gnm import EN_FULL_WEEKDAYS_LIST, FR_WEEKDAYS, as_opening_hours_badge
|
||||||
|
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||||
GEOJSON = json.load(open(os.path.join(BASE_DIR, 'tests/data/mairie-geojson.json')))['features']
|
GEOJSON = json.load(open(os.path.join(BASE_DIR, 'tests/data/mairie-geojson.json')))['features']
|
||||||
|
@ -45,48 +43,48 @@ def test_empty_data():
|
||||||
def test_mairie_bron_monday():
|
def test_mairie_bron_monday():
|
||||||
"""S1326"""
|
"""S1326"""
|
||||||
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1326'][0]
|
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1326'][0]
|
||||||
klass, label = 'open', u"Ouvert jusqu'à 17h15"
|
klass, label = 'open', "Ouvert jusqu'à 17h15"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-08-12 14:59:00")
|
@pytest.mark.freeze_time("2018-08-12 14:59:00")
|
||||||
def test_mairie_bron_sunday():
|
def test_mairie_bron_sunday():
|
||||||
"""S1326"""
|
"""S1326"""
|
||||||
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1326'][0]
|
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1326'][0]
|
||||||
klass, label = 'closed', u"Réouvre demain à 8h00"
|
klass, label = 'closed', "Réouvre demain à 8h00"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-08-09 13:30:01")
|
@pytest.mark.freeze_time("2018-08-09 13:30:01")
|
||||||
def test_mairie_sathonay_thursday_afternoon():
|
def test_mairie_sathonay_thursday_afternoon():
|
||||||
"""S1326"""
|
"""S1326"""
|
||||||
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1415'][0]
|
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1415'][0]
|
||||||
klass, label = 'open', u"Ouvert jusqu'à 17h00"
|
klass, label = 'open', "Ouvert jusqu'à 17h00"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-08-11 11:30:01")
|
@pytest.mark.freeze_time("2018-08-11 11:30:01")
|
||||||
def test_mairie_saint_priest_closed():
|
def test_mairie_saint_priest_closed():
|
||||||
"""S1326"""
|
"""S1326"""
|
||||||
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1406'][0]
|
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1406'][0]
|
||||||
klass, label = 'closed', u"Réouvre lundi à 8h15"
|
klass, label = 'closed', "Réouvre lundi à 8h15"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-08-22 12:13:01")
|
@pytest.mark.freeze_time("2018-08-22 12:13:01")
|
||||||
def test_mairie_saint_priest_open():
|
def test_mairie_saint_priest_open():
|
||||||
"""S1326"""
|
"""S1326"""
|
||||||
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1406'][0]
|
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1406'][0]
|
||||||
klass, label = 'soon-to-be-closed', u"Ouvert jusqu'à 12h15"
|
klass, label = 'soon-to-be-closed', "Ouvert jusqu'à 12h15"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-08-11 14:59:00")
|
@pytest.mark.freeze_time("2018-08-11 14:59:00")
|
||||||
def test_mairie_bron_saturday():
|
def test_mairie_bron_saturday():
|
||||||
"""S1326"""
|
"""S1326"""
|
||||||
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1326'][0]
|
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1326'][0]
|
||||||
klass, label = 'closed', u"Réouvre lundi à 8h00"
|
klass, label = 'closed', "Réouvre lundi à 8h00"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-03-05 09:59:13")
|
@pytest.mark.freeze_time("2018-03-05 09:59:13")
|
||||||
|
@ -95,8 +93,8 @@ def test_jonage_open():
|
||||||
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['nom'] == 'Mairie de Jonage'][
|
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['nom'] == 'Mairie de Jonage'][
|
||||||
0
|
0
|
||||||
]
|
]
|
||||||
klass, label = 'open', u"Ouvert jusqu'à 12h30"
|
klass, label = 'open', "Ouvert jusqu'à 12h30"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-03-05 11:32:00")
|
@pytest.mark.freeze_time("2018-03-05 11:32:00")
|
||||||
|
@ -105,8 +103,8 @@ def test_jonage_soon_to_be_closed():
|
||||||
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['nom'] == 'Mairie de Jonage'][
|
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['nom'] == 'Mairie de Jonage'][
|
||||||
0
|
0
|
||||||
]
|
]
|
||||||
klass, label = 'soon-to-be-closed', u"Ouvert jusqu'à 12h30"
|
klass, label = 'soon-to-be-closed', "Ouvert jusqu'à 12h30"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-03-10 17:30:00")
|
@pytest.mark.freeze_time("2018-03-10 17:30:00")
|
||||||
|
@ -115,19 +113,19 @@ def test_jonage_closed():
|
||||||
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['nom'] == 'Mairie de Jonage'][
|
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['nom'] == 'Mairie de Jonage'][
|
||||||
0
|
0
|
||||||
]
|
]
|
||||||
klass, label = 'closed', u"Réouvre lundi à 8h30"
|
klass, label = 'closed', "Réouvre lundi à 8h30"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-03-05 15:55:00")
|
@pytest.mark.freeze_time("2018-03-05 15:55:00")
|
||||||
def test_data_input_compatibility():
|
def test_data_input_compatibility():
|
||||||
"""as_opening_hours with a fixed datetime"""
|
"""as_opening_hours with a fixed datetime"""
|
||||||
klass = 'open'
|
klass = 'open'
|
||||||
label = u"Ouvert jusqu'à 17h00"
|
label = "Ouvert jusqu'à 17h00"
|
||||||
test_html = as_opening_hours_badge(GEOJSON[1]['properties'])
|
test_html = as_opening_hours_badge(GEOJSON[1]['properties'])
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
test_html = as_opening_hours_badge(GEOJSON[1])
|
test_html = as_opening_hours_badge(GEOJSON[1])
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-03-05 00:00:00")
|
@pytest.mark.freeze_time("2018-03-05 00:00:00")
|
||||||
|
@ -146,35 +144,35 @@ def test_all_mdr_data_parsed_correct():
|
||||||
@pytest.mark.freeze_time("2018-03-05 14:59:00")
|
@pytest.mark.freeze_time("2018-03-05 14:59:00")
|
||||||
def test_mdr_open():
|
def test_mdr_open():
|
||||||
test_html = as_opening_hours_badge(MDR_GEOJSON[0])
|
test_html = as_opening_hours_badge(MDR_GEOJSON[0])
|
||||||
klass, label = 'open', u"Ouvert jusqu'à 16h45"
|
klass, label = 'open', "Ouvert jusqu'à 16h45"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-03-05 15:46:00")
|
@pytest.mark.freeze_time("2018-03-05 15:46:00")
|
||||||
def test_mdr_soon_to_be_closed():
|
def test_mdr_soon_to_be_closed():
|
||||||
test_html = as_opening_hours_badge(MDR_GEOJSON[0])
|
test_html = as_opening_hours_badge(MDR_GEOJSON[0])
|
||||||
klass, label = 'soon-to-be-closed', u"Ouvert jusqu'à 16h45"
|
klass, label = 'soon-to-be-closed', "Ouvert jusqu'à 16h45"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-03-10 17:30:00")
|
@pytest.mark.freeze_time("2018-03-10 17:30:00")
|
||||||
def test_mdr_just_closed():
|
def test_mdr_just_closed():
|
||||||
test_html = as_opening_hours_badge(MDR_GEOJSON[0])
|
test_html = as_opening_hours_badge(MDR_GEOJSON[0])
|
||||||
klass, label = 'closed', u"Réouvre lundi à 8h30"
|
klass, label = 'closed', "Réouvre lundi à 8h30"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-01-01 14:59:00")
|
@pytest.mark.freeze_time("2018-01-01 14:59:00")
|
||||||
def test_mairie_holiday():
|
def test_mairie_holiday():
|
||||||
# Ecully, using datetimes
|
# Ecully, using datetimes
|
||||||
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1361'][0]
|
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1361'][0]
|
||||||
klass, label = 'closed', u"Réouvre demain à 8h30"
|
klass, label = 'closed', "Réouvre demain à 8h30"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
# Feyzin, using dates
|
# Feyzin, using dates
|
||||||
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1365'][0]
|
test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1365'][0]
|
||||||
klass, label = 'closed', u"Réouvre demain à 8h30"
|
klass, label = 'closed', "Réouvre demain à 8h30"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2018-03-05 00:30:00")
|
@pytest.mark.freeze_time("2018-03-05 00:30:00")
|
||||||
|
@ -256,7 +254,7 @@ def test_mairie_format_openinghours(openinghour, badge, text):
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_mairie_format_openinghoursspecification(day, opens, closes, badge, text):
|
def test_mairie_format_openinghoursspecification(day, opens, closes, badge, text):
|
||||||
geojson = """
|
geojson = r"""
|
||||||
{
|
{
|
||||||
"properties": {
|
"properties": {
|
||||||
"openinghoursspecification": [{
|
"openinghoursspecification": [{
|
||||||
|
@ -280,7 +278,7 @@ def test_mairie_format_openinghoursspecification(day, opens, closes, badge, text
|
||||||
@pytest.mark.freeze_time("2018-03-09 00:30:00")
|
@pytest.mark.freeze_time("2018-03-09 00:30:00")
|
||||||
def test_mairie_having_both_formats():
|
def test_mairie_having_both_formats():
|
||||||
"""openinghoursspecification take preference over openinghours"""
|
"""openinghoursspecification take preference over openinghours"""
|
||||||
geojson = """
|
geojson = r"""
|
||||||
{
|
{
|
||||||
"properties": {
|
"properties": {
|
||||||
"openinghours": [
|
"openinghours": [
|
||||||
|
@ -305,8 +303,8 @@ def test_mairie_saint_genis_lavak():
|
||||||
"""#50337"""
|
"""#50337"""
|
||||||
geojson = json.load(open(os.path.join(BASE_DIR, 'tests/data/mairie-saint-genis-lavak.json')))
|
geojson = json.load(open(os.path.join(BASE_DIR, 'tests/data/mairie-saint-genis-lavak.json')))
|
||||||
test_html = as_opening_hours_badge(geojson['features'][0])
|
test_html = as_opening_hours_badge(geojson['features'][0])
|
||||||
klass, label = 'open', u"Ouvert jusqu'à 17h30"
|
klass, label = 'open', "Ouvert jusqu'à 17h30"
|
||||||
assert test_html == mark_safe(u'<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
assert test_html == mark_safe('<div class="badge %s"><span>%s</span></div>' % (klass, label))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time('2018-01-04 14:59:00')
|
@pytest.mark.freeze_time('2018-01-04 14:59:00')
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from combo_plugin_gnm.templatetags.gnm import get_mairie_opening_hours, EN_FULL_WEEKDAYS_LIST, FR_WEEKDAYS
|
import pytest
|
||||||
|
|
||||||
|
from combo_plugin_gnm.templatetags.gnm import EN_FULL_WEEKDAYS_LIST, FR_WEEKDAYS, get_mairie_opening_hours
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||||
GEOJSON = json.load(open(os.path.join(BASE_DIR, 'tests/data/mairie-geojson.json')))['features']
|
GEOJSON = json.load(open(os.path.join(BASE_DIR, 'tests/data/mairie-geojson.json')))['features']
|
||||||
|
@ -30,35 +28,35 @@ def test_mairie_hours_special_data():
|
||||||
if x['properties']['identifiant'] == 'S1376':
|
if x['properties']['identifiant'] == 'S1376':
|
||||||
# La Mulatière : openinghoursspecification set but without opens/closes
|
# La Mulatière : openinghoursspecification set but without opens/closes
|
||||||
assert get_mairie_opening_hours(x) == [
|
assert get_mairie_opening_hours(x) == [
|
||||||
('lundi', {'am': u'08h30-12h00', 'pm': None}),
|
('lundi', {'am': '08h30-12h00', 'pm': None}),
|
||||||
('mardi', {'am': u'08h30-12h30', 'pm': u'13h30-17h00'}),
|
('mardi', {'am': '08h30-12h30', 'pm': '13h30-17h00'}),
|
||||||
('mercredi', {'am': u'08h30-12h30', 'pm': u'13h30-17h00'}),
|
('mercredi', {'am': '08h30-12h30', 'pm': '13h30-17h00'}),
|
||||||
('jeudi', {'am': u'08h30-12h30', 'pm': u'13h30-17h00'}),
|
('jeudi', {'am': '08h30-12h30', 'pm': '13h30-17h00'}),
|
||||||
('vendredi', {'am': u'08h30-12h30', 'pm': u'13h30-17h00'}),
|
('vendredi', {'am': '08h30-12h30', 'pm': '13h30-17h00'}),
|
||||||
('samedi', {'am': u'09h00-11h45', 'pm': None}),
|
('samedi', {'am': '09h00-11h45', 'pm': None}),
|
||||||
]
|
]
|
||||||
|
|
||||||
if x['properties']['identifiant'] == 'S1437':
|
if x['properties']['identifiant'] == 'S1437':
|
||||||
x['properties']['openinghoursspecification'] = [] # force using openinghours
|
x['properties']['openinghoursspecification'] = [] # force using openinghours
|
||||||
# special openinghours format with days intervals, comma-separated list and one day definition with a saturday
|
# special openinghours format with days intervals, comma-separated list and one day definition with a saturday
|
||||||
assert get_mairie_opening_hours(x) == [
|
assert get_mairie_opening_hours(x) == [
|
||||||
('lundi', {'am': u'08h45-12h30', 'pm': u'14h00-16h45'}),
|
('lundi', {'am': '08h45-12h30', 'pm': '14h00-16h45'}),
|
||||||
('mardi', {'am': u'08h45-16h45', 'pm': ''}),
|
('mardi', {'am': '08h45-16h45', 'pm': ''}),
|
||||||
('mercredi', {'am': u'08h45-16h45', 'pm': ''}),
|
('mercredi', {'am': '08h45-16h45', 'pm': ''}),
|
||||||
('jeudi', {'am': u'08h45-18h00', 'pm': ''}),
|
('jeudi', {'am': '08h45-18h00', 'pm': ''}),
|
||||||
('vendredi', {'am': u'08h45-16h45', 'pm': ''}),
|
('vendredi', {'am': '08h45-16h45', 'pm': ''}),
|
||||||
('samedi', {'am': u'09h00-12h00', 'pm': None}),
|
('samedi', {'am': '09h00-12h00', 'pm': None}),
|
||||||
]
|
]
|
||||||
|
|
||||||
if x['properties']['identifiant'] == 'S5564':
|
if x['properties']['identifiant'] == 'S5564':
|
||||||
x['properties']['openinghoursspecification'] = [] # force using openinghours
|
x['properties']['openinghoursspecification'] = [] # force using openinghours
|
||||||
# classic openinghours days interval for am and pm
|
# classic openinghours days interval for am and pm
|
||||||
assert get_mairie_opening_hours(x) == [
|
assert get_mairie_opening_hours(x) == [
|
||||||
('lundi', {'am': u'08h30-12h15', 'pm': u'13h15-17h00'}),
|
('lundi', {'am': '08h30-12h15', 'pm': '13h15-17h00'}),
|
||||||
('mardi', {'am': u'08h30-12h15', 'pm': u'13h15-17h00'}),
|
('mardi', {'am': '08h30-12h15', 'pm': '13h15-17h00'}),
|
||||||
('mercredi', {'am': u'08h30-12h15', 'pm': u'13h15-17h00'}),
|
('mercredi', {'am': '08h30-12h15', 'pm': '13h15-17h00'}),
|
||||||
('jeudi', {'am': u'08h30-12h15', 'pm': u'13h15-17h00'}),
|
('jeudi', {'am': '08h30-12h15', 'pm': '13h15-17h00'}),
|
||||||
('vendredi', {'am': u'08h30-12h15', 'pm': u'13h15-17h00'}),
|
('vendredi', {'am': '08h30-12h15', 'pm': '13h15-17h00'}),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,12 +99,12 @@ def test_mairie_sathonay_timetable():
|
||||||
get_mairie_opening_hours(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1415'
|
get_mairie_opening_hours(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1415'
|
||||||
][0]
|
][0]
|
||||||
assert test_time_table == [
|
assert test_time_table == [
|
||||||
('lundi', {'am': u'08h30-12h00', 'pm': u'14h00-17h00'}),
|
('lundi', {'am': '08h30-12h00', 'pm': '14h00-17h00'}),
|
||||||
('mardi', {'am': u'08h30-12h00', 'pm': u'13h30-17h00'}),
|
('mardi', {'am': '08h30-12h00', 'pm': '13h30-17h00'}),
|
||||||
('mercredi', {'am': u'08h30-12h00', 'pm': u'14h00-17h00'}),
|
('mercredi', {'am': '08h30-12h00', 'pm': '14h00-17h00'}),
|
||||||
('jeudi', {'am': u'08h30-12h00', 'pm': u'14h00-17h00'}),
|
('jeudi', {'am': '08h30-12h00', 'pm': '14h00-17h00'}),
|
||||||
('vendredi', {'am': u'08h30-12h00', 'pm': u'14h00-17h00'}),
|
('vendredi', {'am': '08h30-12h00', 'pm': '14h00-17h00'}),
|
||||||
('samedi', {'am': u'08h30-12h00', 'pm': None}),
|
('samedi', {'am': '08h30-12h00', 'pm': None}),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,12 +114,12 @@ def test_mairie_saint_priest():
|
||||||
get_mairie_opening_hours(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1406'
|
get_mairie_opening_hours(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1406'
|
||||||
][0]
|
][0]
|
||||||
assert test_time_table == [
|
assert test_time_table == [
|
||||||
('lundi', {'am': u'08h15-12h15', 'pm': u'13h30-17h30'}),
|
('lundi', {'am': '08h15-12h15', 'pm': '13h30-17h30'}),
|
||||||
('mardi', {'am': u'08h15-12h15', 'pm': u'13h30-17h30'}),
|
('mardi', {'am': '08h15-12h15', 'pm': '13h30-17h30'}),
|
||||||
('mercredi', {'am': u'08h15-12h15', 'pm': u'13h30-17h30'}),
|
('mercredi', {'am': '08h15-12h15', 'pm': '13h30-17h30'}),
|
||||||
('jeudi', {'am': u'08h15-11h15', 'pm': u'13h30-17h30'}),
|
('jeudi', {'am': '08h15-11h15', 'pm': '13h30-17h30'}),
|
||||||
('vendredi', {'am': u'08h15-12h15', 'pm': u'13h30-17h30'}),
|
('vendredi', {'am': '08h15-12h15', 'pm': '13h30-17h30'}),
|
||||||
('samedi', {'am': u'09h00-11h30', 'pm': None}),
|
('samedi', {'am': '09h00-11h30', 'pm': None}),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,7 +153,7 @@ def test_mairie_format_openinghours():
|
||||||
@pytest.mark.freeze_time("2018-03-09 00:30:00")
|
@pytest.mark.freeze_time("2018-03-09 00:30:00")
|
||||||
def test_mairie_format_openinghoursspecification():
|
def test_mairie_format_openinghoursspecification():
|
||||||
"""openinghoursspecification the default format"""
|
"""openinghoursspecification the default format"""
|
||||||
geojson = """
|
geojson = r"""
|
||||||
{
|
{
|
||||||
"properties": {
|
"properties": {
|
||||||
"openinghoursspecification": [{
|
"openinghoursspecification": [{
|
||||||
|
@ -217,7 +215,7 @@ def test_mairie_format_openinghoursspecification():
|
||||||
@pytest.mark.freeze_time("2018-03-09 00:30:00")
|
@pytest.mark.freeze_time("2018-03-09 00:30:00")
|
||||||
def test_mairie_having_both_formats():
|
def test_mairie_having_both_formats():
|
||||||
"""openinghoursspecification take preference over openinghours"""
|
"""openinghoursspecification take preference over openinghours"""
|
||||||
geojson = """
|
geojson = r"""
|
||||||
{
|
{
|
||||||
"properties": {
|
"properties": {
|
||||||
"openinghours": [
|
"openinghours": [
|
||||||
|
|
Loading…
Reference in New Issue