def test_operator(self): sciA = sciEntry('seqA', 'seqB', 0.1) refSciA = sciEntry('seqA', 'seqB', 0.2) sciC = sciA - refSciA self.assertEqual(sciC.is_diff, True) self.assertEqual(sciC.sequence_a, 'seqA') self.assertEqual(sciC.sequence_b, 'seqB') self.assertEqual(sciC.sci, -0.1)
def test_to_string(self): sciA = sciEntry('seqA', 'seqB', 0.1) self.assertEqual(sciA.to_string(), 'seqA\tseqB\t0.100000') refSciA = sciEntry('seqA', 'seqB', 0.2) sciC = sciA - refSciA self.assertEqual(sciC.is_diff, True) self.assertEqual(sciC.sequence_a, 'seqA') self.assertEqual(sciC.sequence_b, 'seqB') self.assertEqual(sciC.sci, -0.1)
def test_init(self): sciA = sciEntry('seqA', 'seqB', 0.1) self.assertEqual(sciA.sequence_a, 'seqA') self.assertEqual(sciA.sequence_b, 'seqB') self.assertEqual(sciA.sci, 0.1) self.assertEqual(sciA.id, 'seqA seqB') self.assertEqual(sciA.is_diff, False) sciB = sciEntry('seqC', 'seqD', 0.1, is_diff=True) self.assertEqual(sciB.sequence_a, 'seqC') self.assertEqual(sciB.sequence_b, 'seqD') self.assertEqual(sciB.sci, 0.1) self.assertEqual(sciB.id, 'seqC seqD') self.assertEqual(sciB.is_diff, True)
def test_from_string(self): sci_string = 'seqA\tseqB\tseqC\t\tasdas\tssd\t0.1' sciA = sciEntry.from_string(sci_string) sciA = sciEntry('seqA', 'seqB', 0.1) self.assertEqual(sciA.sequence_a, 'seqA') self.assertEqual(sciA.sequence_b, 'seqB') self.assertEqual(sciA.sci, 0.1) self.assertEqual(sciA.id, 'seqA seqB') self.assertEqual(sciA.is_diff, False)
def test_exception_thrown(self): sciA = sciEntry('seqA', 'seqB', 0.1) refSciA = sciEntry('seqC', 'seqD', 0.2) t = lambda x, y: x - y self.assertRaises(ValueError, t, refSciA, sciA)
def test_exception_thrown(self): sciA = sciEntry('seqA', 'seqB', 0.1) refSciA = sciEntry('seqC', 'seqD', 0.2) t = lambda x, y : x - y self.assertRaises(ValueError, t, refSciA, sciA)