def setUp(self): self.renderPatch = patch('clonotypes.views.render', render_echo) self.renderPatch.start() self.request = FakeRequestFactory() make_fake_patient() self.s = Sample.objects.get() self.aa = AminoAcid.objects.get()
def test_parse_nucleotide_should_not_create_a_span_if_index_is_lt_0(self): ''' Adaptive uses -1 in the index field to represent the lack of that element. This test makes sure rendered text does no create a span for an empty region ''' make_fake_patient() r = Recombination.objects.get() r.j_start = 10 r.d_end = 9 pr = r.parsed_nucleotide() self.assertNotIn('<span class="dj_additions"', pr) r = Recombination.objects.get() r.d_start = 8 r.d_end = 9 pr = r.parsed_nucleotide() self.assertNotIn('<span class="d_gene"', pr) r = Recombination.objects.get() r.v_end = 6 r.d_start = 7 pr = r.parsed_nucleotide() self.assertNotIn('<span class="vd_additions"', pr)
def test_parsed_nucleotide_should_wrap_spans_around_nucleotide_groups(self): make_fake_patient() r = Recombination.objects.get() pr = r.parsed_nucleotide() # Test v regex = re.compile('.*<span class="v_gene">(.*?)</span>') match = regex.match(pr) self.assertEqual(len(match.groups()[0]), r.v_end) # VD junction regex = re.compile('.*<span class="vd_additions">(.*?)</span>') match = regex.match(pr) num_n2_additions = r.d_start - r.v_end self.assertEqual(len(match.groups()[0]), num_n2_additions) # D regex = re.compile('.*<span class="d_gene">(.*?)</span>') match = regex.match(pr) d_length = r.d_end- r.d_start self.assertEqual(len(match.groups()[0]), d_length) # DJ Junction regex = re.compile('.*<span class="dj_additions">(.*?)</span>') match = regex.match(pr) num_n1_additions = r.j_start - r.d_end self.assertEqual(len(match.groups()[0]), num_n1_additions) # J regex = re.compile('.*<span class="j_gene">(.*?)</span>') match = regex.match(pr) j_length = len(r.nucleotide) - r.j_start self.assertEqual(len(match.groups()[-1]), j_length)
def DONTtest_summary_page_shows_productivity_choices_using_form(self): make_fake_patient() fake_sample = Sample.objects.get() response = self.client.get(reverse('samples.views.summary', args=[fake_sample.id])) self.assertTrue(isinstance(response.context['form'], FilterForm))
def setUp(self): make_fake_patient() self.fake_sample = Sample.objects.get() self.aa = AminoAcid.objects.get()
def setUp(self): make_fake_patient() self.fake_sample = Sample.objects.get() self.clonotype = Clonotype.objects.all()[:1].get() self.response = self.client.get( reverse('clonotypes.views.detail', args=[self.clonotype.id]))
def setUp(self): make_fake_patient() self.s = Sample.objects.get() self.p = Patient.objects.get()
def test_parsed_nucleotide_returns_a_string(self): make_fake_patient() r = Recombination.objects.get() pr = r.parsed_nucleotide() self.assertIsInstance(pr, str)
def test_parsed_nucleotide_should_return_nucleotide_sequence(self): make_fake_patient() r = Recombination.objects.get() pr = r.parsed_nucleotide() no_html = re.sub('<[^<]+?>', '', pr) self.assertEqual(r.nucleotide, no_html)