X-Git-Url: http://woldlab.caltech.edu/gitweb/?a=blobdiff_plain;f=htsworkflow%2Ffrontend%2Fexperiments%2Ftest_experiments.py;fp=htsworkflow%2Ffrontend%2Fexperiments%2Ftest_experiments.py;h=4a665e1222e5ab1e625cbee44b3e2f5f88985d97;hb=b15ba98c27dd2c34cedbe2b1f861899b859b6355;hp=9cafb03d992004ec97b5f3cde31745cb4e7f73b0;hpb=cb696a0bd80ac220fc4aa6b3dc94ba6d0be67c82;p=htsworkflow.git diff --git a/htsworkflow/frontend/experiments/test_experiments.py b/htsworkflow/frontend/experiments/test_experiments.py index 9cafb03..4a665e1 100644 --- a/htsworkflow/frontend/experiments/test_experiments.py +++ b/htsworkflow/frontend/experiments/test_experiments.py @@ -4,6 +4,7 @@ try: import json except ImportError, e: import simplejson as json +from datetime import timedelta import os import shutil import sys @@ -481,6 +482,25 @@ class ExperimentsTestCases(TestCase): self.assertTrue(library_id in expected[lane_id]) self.assertEqual(count, 10) + def test_flowcell_estimates(self): + classic_flowcell = models.FlowCell.objects.get(pk=153) + classic_mid = experiments.estimateFlowcellDuration(classic_flowcell) + + self.assertEqual(classic_mid, timedelta(4, 44000)) + + rapid_flowcell = models.FlowCell.objects.get(pk=300) + rapid_mid = experiments.estimateFlowcellDuration(rapid_flowcell) + self.assertEqual(rapid_mid, timedelta(seconds=60800)) + + def test_round_to_days(self): + data = [ + [timedelta(2, 12345), (timedelta(days=2), timedelta(days=3))], + [timedelta(0, 345), (timedelta(days=0), timedelta(days=1))], + ] + + for estimate, expected in data: + rounded = experiments.roundToDays(estimate) + self.assertEqual(rounded, expected) class TestFileType(TestCase): fixtures = ['initial_data.json',