def test_normalize(self): """UnsafeFreqs should normalize based on the uppercase RNA alphabet""" u = UnsafeBaseUsage() #note that the lower-case u will be discarded, not converted u += 'AAACCGGGGGu' u.normalize() self.assertFloatEqual(u, {'A': 0.3, 'C': 0.2, 'G': 0.5, 'U': 0.0})
def test_normalize(self): """UnsafeFreqs should normalize based on the uppercase RNA alphabet""" u = UnsafeBaseUsage() #note that the lower-case u will be discarded, not converted u += 'AAACCGGGGGu' u.normalize() self.assertFloatEqual(u, {'A':0.3, 'C':0.2, 'G':0.5, 'U':0.0})
def test_init(self): """UnsafeFreqs uses dict init, so must use += after creation for others""" self.assertRaises(ValueError, UnsafeBaseUsage, 'acguc') u = UnsafeBaseUsage() u += 'acgtc' #note lack of conversion to uppercase RNA! self.assertEqual(u, {'a': 1, 'c': 2, 'g': 1, 't': 1})