from lxml.html import fromstring
try:
import json
-except ImportError, e:
+except ImportError as e:
import simplejson as json
import os
import shutil
import sys
import tempfile
-from urlparse import urljoin
+from urllib.parse import urljoin
from django.conf import settings
from django.core import mail
from htsworkflow.pipelines.test.simulate_runfolder import TESTDATA_DIR
-LANE_SET = range(1,9)
+LANE_SET = list(range(1,9))
NSMAP = {'libns':'http://jumpgate.caltech.edu/wiki/LibraryOntology#'}
"""
Check the code that packs the django objects into simple types.
"""
- for fc_id in [u'FC12150', u"42JTNAAXX", "42JU1AAXX"]:
+ for fc_id in ['FC12150', "42JTNAAXX", "42JU1AAXX"]:
fc_dict = experiments.flowcell_information(fc_id)
fc_django = models.FlowCell.objects.get(flowcell_id=fc_id)
self.assertEqual(fc_dict['flowcell_id'], fc_id)
for lane in fc_django.lane_set.all():
- lane_contents = fc_json['lane_set'][unicode(lane.lane_number)]
+ lane_contents = fc_json['lane_set'][str(lane.lane_number)]
lane_dict = multi_lane_to_dict(lane_contents)[lane.library_id]
self.assertEqual(lane_dict['cluster_estimate'], lane.cluster_estimate)
"""
Require logging in to retrieve meta data
"""
- response = self.client.get(u'/experiments/config/FC12150/json')
+ response = self.client.get('/experiments/config/FC12150/json')
self.assertEqual(response.status_code, 403)
def test_library_id(self):
This tests to make sure that the value entered in the raw library id field matches
the library id looked up.
"""
- expected_ids = [u'10981',u'11016',u'SL039',u'11060',
- u'11061',u'11062',u'11063',u'11064']
+ expected_ids = ['10981','11016','SL039','11060',
+ '11061','11062','11063','11064']
self.client.login(username='supertest', password='BJOKL5kAj6aFZ6A5')
response = self.client.get('/admin/experiments/flowcell/153/')
lane_dict = multi_lane_to_dict(lane_contents)
self.assertEqual(lane_dict['12044']['index_sequence'],
- {u'1': u'ATCACG',
- u'2': u'CGATGT',
- u'3': u'TTAGGC'})
+ {'1': 'ATCACG',
+ '2': 'CGATGT',
+ '3': 'TTAGGC'})
self.assertEqual(lane_dict['11045']['index_sequence'],
- {u'1': u'ATCACG'})
+ {'1': 'ATCACG'})
count = 0
for r in query.execute(model):
count += 1
- self.assertEqual(fromTypedNode(r['flowcell_id']), u'42JU1AAXX')
+ self.assertEqual(fromTypedNode(r['flowcell_id']), '42JU1AAXX')
lane_id = fromTypedNode(r['lane_id'])
library_id = fromTypedNode(r['library_id'])
self.assertTrue(library_id in expected[lane_id])
file_type_objects = models.FileType.objects
name = 'QSEQ tarfile'
file_type_object = file_type_objects.get(name=name)
- self.assertEqual(u"QSEQ tarfile",
- unicode(file_type_object))
+ self.assertEqual("QSEQ tarfile",
+ str(file_type_object))
def test_find_file_type(self):
file_type_objects = models.FileType.objects
seq.instrument_name = "HWI-SEQ1"
seq.model = "Imaginary 5000"
- self.assertEqual(unicode(seq), "Seq1 (HWI-SEQ1)")
+ self.assertEqual(str(seq), "Seq1 (HWI-SEQ1)")
def test_lookup(self):
fc = models.FlowCell.objects.get(pk=153)
teardown_test_environment()
def suite():
- from unittest2 import TestSuite, defaultTestLoader
+ from unittest import TestSuite, defaultTestLoader
suite = TestSuite()
for testcase in [ClusterStationTestCases,
SequencerTestCases,
return suite
if __name__ == "__main__":
- from unittest2 import main
+ from unittest import main
main(defaultTest="suite")