dataprep ... coverage
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,9 @@ from __future__ import unicode_literals
|
||||
from .statements import *
|
||||
from rowers.mytypes import rowtypes
|
||||
from rowers.utils import allmonths,allsundays
|
||||
from rowers.models import update_records
|
||||
|
||||
from django.db import transaction
|
||||
|
||||
nu = datetime.datetime.now()
|
||||
|
||||
@@ -308,9 +310,13 @@ class DataPrepTests(TestCase):
|
||||
self.r = Rower.objects.create(user=self.u,
|
||||
birthdate=faker.profile()['birthdate'],
|
||||
gdproptin=True,surveydone=True,
|
||||
sex='male',
|
||||
gdproptindate=timezone.now(),
|
||||
rowerplan='coach')
|
||||
|
||||
self.r.birthdate = timezone.now()-datetime.timedelta(days=25*365)
|
||||
self.r.save()
|
||||
|
||||
self.c = Client()
|
||||
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
||||
self.factory = RequestFactory()
|
||||
@@ -329,10 +335,37 @@ class DataPrepTests(TestCase):
|
||||
workouttype = 'water',
|
||||
)
|
||||
|
||||
with open('rowers/tests/testdata/c2records.json','r') as f:
|
||||
s = f.read()
|
||||
|
||||
data = json.loads(s)
|
||||
for obj in data:
|
||||
m = obj['fields']
|
||||
record = C2WorldClassAgePerformance(**m)
|
||||
record.save()
|
||||
|
||||
with open('rowers/tests/testdata/calcageperformance.json','r') as f:
|
||||
s = f.read()
|
||||
|
||||
data = json.loads(s)
|
||||
for obj in data:
|
||||
m = obj['fields']
|
||||
record = CalcAgePerformance(**m)
|
||||
#print(record.sex,record.age,record.weightcategory,record.duration,record.power)
|
||||
record.save()
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def test_goldmedalstandard(self):
|
||||
maxvalue, delta = dataprep.calculate_goldmedalstandard(self.r,self.wuh_otw)
|
||||
records = CalcAgePerformance.objects.filter(
|
||||
age=dataprep.calculate_age(self.r.birthdate),
|
||||
weightcategory=self.r.weightcategory,
|
||||
sex=self.r.sex)
|
||||
self.assertEqual(int(maxvalue),9)
|
||||
self.assertEqual(delta,6)
|
||||
|
||||
@patch('rowers.dataprep.getsmallrowdata_db',side_effect=mocked_getsmallrowdata_uh)
|
||||
def test_get_videodata(self,mocked_getsmallrowdata_uh):
|
||||
data, metrics, maxtime = dataprep.get_video_data(self.wuh_otw)
|
||||
|
||||
Reference in New Issue
Block a user