def test_clonotypes_have_these_required_fields(self): s = SampleFactory() r = RecombinationFactory() data = {'sample': s, 'frequency': 0.1, 'count': 1, 'recombination': r, } c = Clonotype() for key, value in data.items(): setattr(c, key, value) c.save() c_in_db = Clonotype.objects.get() for key, value in data.items(): self.assertEqual( value, getattr(c_in_db, key), 'key value %s not equal' % key)
def test_create_clonotypes_for_a_sample(self): p = Patient() p.save() s = Sample(patient=p) s.save() r = RecombinationFactory() c = Clonotype( sample=s, recombination=r, frequency=9.336458E-6, count=2, ) c.save() # Get all clonotypes from database all_clonotypes = Clonotype.objects.all() self.assertEqual(all_clonotypes[0], c)