Private
Public Access
1
0

coverage related changes

This commit is contained in:
Sander Roosendaal
2021-04-26 17:48:22 +02:00
parent 7626554ba9
commit 9e2a97e721
17 changed files with 1534 additions and 144 deletions

View File

@@ -14,21 +14,21 @@ import uuid
from django.core.exceptions import ValidationError
def format_pace_tick(x,pos=None):
def format_pace_tick(x,pos=None): # pragma: no cover
minu=int(x/60)
sec=int(x-minu*60.)
sec_str=str(sec).zfill(2)
template='%d:%s'
return template % (minu,sec_str)
def format_time_tick(x,pos=None):
def format_time_tick(x,pos=None): # pragma: no cover
hour=int(x/3600)
min=int((x-hour*3600.)/60)
min_str=str(min).zfill(2)
template='%d:%s'
return template % (hour,min_str)
def format_pace(x,pos=None):
def format_pace(x,pos=None): # pragma: no cover
if isinf(x) or isnan(x):
x=0
@@ -42,7 +42,7 @@ def format_pace(x,pos=None):
return str1
def format_time(x,pos=None):
def format_time(x,pos=None): # pragma: no cover
min = int(x/60.)
@@ -60,7 +60,7 @@ def validate_image_extension(value):
ext = os.path.splitext(value.name)[1].lower()
valid_extension = ['.jpg','.jpeg','.png','.gif']
if not ext in valid_extension:
if not ext in valid_extension: # pragma: no cover
raise ValidationError(u'File not supported')
def validate_file_extension(value):
@@ -69,25 +69,25 @@ def validate_file_extension(value):
valid_extensions = ['.tcx','.csv','.TCX','.gpx','.GPX',
'.CSV','.fit','.FIT','.zip','.ZIP',
'.gz','.GZ','.xls']
if not ext in valid_extensions:
if not ext in valid_extensions: # pragma: no cover
raise ValidationError(u'File not supported!')
def must_be_csv(value):
import os
ext = os.path.splitext(value.name)[1]
valid_extensions = ['.csv','.CSV']
if not ext in valid_extensions:
if not ext in valid_extensions: # pragma: no cover
raise ValidationError(u'File not supported!')
def validate_kml(value):
import os
ext = os.path.splitext(value.name)[1]
valid_extensions = ['.kml','.KML']
if not ext in valid_extensions:
if not ext in valid_extensions: # pragma: no cover
raise ValidationError(u'File not supported!')
def handle_uploaded_image(i):
def handle_uploaded_image(i): # pragma: no cover
from io import StringIO, BytesIO
from PIL import Image, ImageOps, ExifTags
import os
@@ -121,7 +121,7 @@ def handle_uploaded_image(i):
try:
if exif[orientation] == 3:
mage=image.rotate(180, expand=True)
image=image.rotate(180, expand=True)
elif exif[orientation] == 6:
image=image.rotate(270, expand=True)
elif exif[orientation] == 8: