projects
/
htsworkflow.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Initial port to python3
[htsworkflow.git]
/
htsworkflow
/
frontend
/
samples
/
test_samples.py
diff --git
a/htsworkflow/frontend/samples/test_samples.py
b/htsworkflow/frontend/samples/test_samples.py
index f0844e55cce7fbf3b33fbdfbf03b9d9264b3e13a..12a4b5ba9e692366e585932ba7f7d93f8c118db7 100644
(file)
--- a/
htsworkflow/frontend/samples/test_samples.py
+++ b/
htsworkflow/frontend/samples/test_samples.py
@@
-2,7
+2,7
@@
import datetime
try:
import json
try:
import json
-except ImportError
,
e:
+except ImportError
as
e:
import simplejson as json
from django.test import TestCase
import simplejson as json
from django.test import TestCase
@@
-93,28
+93,28
@@
class SampleWebTestCase(TestCase):
self.failUnlessEqual(d['stopping_point'], lib.stopping_point)
self.failUnlessEqual(d['successful_pM'], lib.successful_pM)
self.failUnlessEqual(d['undiluted_concentration'],
self.failUnlessEqual(d['stopping_point'], lib.stopping_point)
self.failUnlessEqual(d['successful_pM'], lib.successful_pM)
self.failUnlessEqual(d['undiluted_concentration'],
-
unicode
(lib.undiluted_concentration))
+
str
(lib.undiluted_concentration))
# some specific tests
if lib.id == '10981':
# test a case where there is no known status
# some specific tests
if lib.id == '10981':
# test a case where there is no known status
- lane_set = {
u'status': u
'Unknown',
-
u
'paired_end': True,
-
u
'read_length': 75,
-
u
'lane_number': 1,
-
u
'lane_id': 1193,
-
u'flowcell': u
'303TUAAXX',
-
u
'status_code': None}
+ lane_set = {
'status':
'Unknown',
+ 'paired_end': True,
+ 'read_length': 75,
+ 'lane_number': 1,
+ 'lane_id': 1193,
+
'flowcell':
'303TUAAXX',
+ 'status_code': None}
self.failUnlessEqual(len(d['lane_set']), 1)
self.failUnlessEqual(d['lane_set'][0], lane_set)
elif lib.id == '11016':
# test a case where there is a status
self.failUnlessEqual(len(d['lane_set']), 1)
self.failUnlessEqual(d['lane_set'][0], lane_set)
elif lib.id == '11016':
# test a case where there is a status
- lane_set = {
u
'status': 'Good',
-
u
'paired_end': True,
-
u
'read_length': 75,
-
u
'lane_number': 5,
-
u
'lane_id': 1197,
-
u'flowcell': u
'303TUAAXX',
-
u
'status_code': 2}
+ lane_set = {'status': 'Good',
+ 'paired_end': True,
+ 'read_length': 75,
+ 'lane_number': 5,
+ 'lane_id': 1197,
+
'flowcell':
'303TUAAXX',
+ 'status_code': 2}
self.failUnlessEqual(len(d['lane_set']), 1)
self.failUnlessEqual(d['lane_set'][0], lane_set)
self.failUnlessEqual(len(d['lane_set']), 1)
self.failUnlessEqual(d['lane_set'][0], lane_set)
@@
-169,11
+169,11
@@
class SampleWebTestCase(TestCase):
}"""
query = RDF.SPARQLQuery(body)
for r in query.execute(model):
}"""
query = RDF.SPARQLQuery(body)
for r in query.execute(model):
- self.assertEqual(fromTypedNode(r['library_id']),
u
'10981')
+ self.assertEqual(fromTypedNode(r['library_id']), '10981')
self.assertEqual(fromTypedNode(r['name']),
self.assertEqual(fromTypedNode(r['name']),
-
u
'Paired End Multiplexed Sp-BAC')
+ 'Paired End Multiplexed Sp-BAC')
self.assertEqual(fromTypedNode(r['gel_cut']), 400)
self.assertEqual(fromTypedNode(r['gel_cut']), 400)
- self.assertEqual(fromTypedNode(r['made_by']),
u
'Igor')
+ self.assertEqual(fromTypedNode(r['made_by']), 'Igor')
state = validate_xhtml(content)
if state is not None:
state = validate_xhtml(content)
if state is not None:
@@
-220,7
+220,7
@@
class SampleWebTestCase(TestCase):
count = 0
for r in query.execute(model):
count += 1
count = 0
for r in query.execute(model):
count += 1
- for name, value in
r.items(
):
+ for name, value in
list(r.items()
):
self.assertTrue(name in bindings)
self.assertTrue(value is not None)
self.assertTrue(name in bindings)
self.assertTrue(value is not None)
@@
-274,7
+274,7
@@
try:
rdfNS = RDF.NS("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
xsdNS = RDF.NS("http://www.w3.org/2001/XMLSchema#")
libNS = RDF.NS("http://jumpgate.caltech.edu/wiki/LibraryOntology#")
rdfNS = RDF.NS("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
xsdNS = RDF.NS("http://www.w3.org/2001/XMLSchema#")
libNS = RDF.NS("http://jumpgate.caltech.edu/wiki/LibraryOntology#")
-except ImportError
,
e:
+except ImportError
as
e:
HAVE_RDF = False
HAVE_RDF = False
@@
-300,12
+300,12
@@
class TestRDFaLibrary(TestCase):
self.check_literal_object(model, ['Drosophila melanogaster'], p=libNS['species_name'])
self.check_uri_object(model,
self.check_literal_object(model, ['Drosophila melanogaster'], p=libNS['species_name'])
self.check_uri_object(model,
- [
u
'http://localhost/lane/1193'],
+ ['http://localhost/lane/1193'],
p=libNS['has_lane'])
fc_uri = RDF.Uri('http://localhost/flowcell/303TUAAXX/')
self.check_literal_object(model,
p=libNS['has_lane'])
fc_uri = RDF.Uri('http://localhost/flowcell/303TUAAXX/')
self.check_literal_object(model,
- [
u
"303TUAAXX"],
+ ["303TUAAXX"],
s=fc_uri, p=libNS['flowcell_id'])
def check_literal_object(self, model, values, s=None, p=None, o=None):
s=fc_uri, p=libNS['flowcell_id'])
def check_literal_object(self, model, values, s=None, p=None, o=None):
@@
-323,7
+323,7
@@
class TestRDFaLibrary(TestCase):
self.failUnlessEqual(len(statements), len(values),
"Couln't find %s %s %s" % (s,p,o))
for s in statements:
self.failUnlessEqual(len(statements), len(values),
"Couln't find %s %s %s" % (s,p,o))
for s in statements:
- self.failUnless(
unicode
(s.object.uri) in values)
+ self.failUnless(
str
(s.object.uri) in values)
@@
-342,7
+342,7
@@
def tearDownModule():
teardown_test_environment()
def suite():
teardown_test_environment()
def suite():
- from unittest
2
import TestSuite, defaultTestLoader
+ from unittest import TestSuite, defaultTestLoader
suite = TestSuite()
suite.addTests(defaultTestLoader.loadTestsFromTestCase(LibraryTestCase))
suite.addTests(defaultTestLoader.loadTestsFromTestCase(SampleWebTestCase))
suite = TestSuite()
suite.addTests(defaultTestLoader.loadTestsFromTestCase(LibraryTestCase))
suite.addTests(defaultTestLoader.loadTestsFromTestCase(SampleWebTestCase))
@@
-350,5
+350,5
@@
def suite():
return suite
if __name__ == "__main__":
return suite
if __name__ == "__main__":
- from unittest
2
import main
+ from unittest import main
main(defaultTest="suite")
main(defaultTest="suite")