def test_gt(self): r = ReferenceName('1') rprefix = ReferenceName('chr1') r2 = ReferenceName('2') r2prefix = ReferenceName('chr2') self.assertTrue(rprefix >= r) self.assertTrue(r >= rprefix) self.assertFalse(r > rprefix) self.assertFalse(rprefix > r) for chr1, chr2 in itertools.product([r, rprefix], [r2, r2prefix]): self.assertTrue(chr2 > chr1) self.assertTrue(chr2 >= chr1)
def test_gt(self): r = ReferenceName('1') rprefix = ReferenceName('chr1') r2 = ReferenceName('2') r2prefix = ReferenceName('chr2') assert rprefix >= r assert r >= rprefix assert not r > rprefix assert not rprefix > r for chr1, chr2 in itertools.product([r, rprefix], [r2, r2prefix]): assert chr2 > chr1 assert chr2 >= chr1
def test_lt(self): r = ReferenceName('1') rprefix = ReferenceName('chr1') r2 = ReferenceName('2') r2prefix = ReferenceName('chr2') assert r <= rprefix assert not r < rprefix assert not rprefix < r assert rprefix <= r for chr1, chr2 in itertools.product([r, rprefix], [r2, r2prefix]): assert chr1 < chr2 assert chr1 <= chr2
def test_lt(self): r = ReferenceName('1') rprefix = ReferenceName('chr1') r2 = ReferenceName('2') r2prefix = ReferenceName('chr2') self.assertTrue(r <= rprefix) self.assertFalse(r < rprefix) self.assertFalse(rprefix < r) self.assertTrue(rprefix <= r) for chr1, chr2 in itertools.product([r, rprefix], [r2, r2prefix]): self.assertTrue(chr1 < chr2) self.assertTrue(chr1 <= chr2)
def test_obj_comparison(self): r = ReferenceName('1') rprefix = ReferenceName('chr1') r2 = ReferenceName('2') r2prefix = ReferenceName('chr2') assert rprefix == r assert r == rprefix assert ReferenceName('chr1') == rprefix assert ReferenceName('1') == r assert rprefix != r2 assert rprefix != r2prefix assert r != r2 assert r != r2prefix assert r == rprefix assert r != r2prefix assert not r != rprefix
def test_obj_comparison(self): r = ReferenceName('1') rprefix = ReferenceName('chr1') r2 = ReferenceName('2') r2prefix = ReferenceName('chr2') self.assertEqual(r, rprefix) self.assertEqual(rprefix, r) self.assertEqual(rprefix, ReferenceName('chr1')) self.assertEqual(r, ReferenceName('1')) self.assertNotEqual(r2, rprefix) self.assertNotEqual(r2prefix, rprefix) self.assertNotEqual(r2, r) self.assertNotEqual(r2prefix, r) self.assertTrue(r == rprefix) self.assertTrue(r != r2prefix) self.assertFalse(r != rprefix)
def test_hash(self): assert ReferenceName('3') in {ReferenceName('3')} assert ReferenceName('3') in {ReferenceName('chr3')}
def test_alpha_sort(self): assert ReferenceName('10') < ReferenceName('3') assert ReferenceName('10') < ReferenceName('chr3') assert ReferenceName('chr10') < ReferenceName('3') assert ReferenceName('chr10') < ReferenceName('chr3')
def test_prefixed_vs_naked_str(self): assert ReferenceName('chr1') == '1' assert ReferenceName('chr1') != '2' assert ReferenceName('chr1') == '1'
def test_hash(self): self.assertTrue(ReferenceName('3') in {ReferenceName('3')}) self.assertTrue(ReferenceName('3') in {ReferenceName('chr3')})
def test_alpha_sort(self): self.assertTrue(ReferenceName('10') < ReferenceName('3')) self.assertTrue(ReferenceName('10') < ReferenceName('chr3')) self.assertTrue(ReferenceName('chr10') < ReferenceName('3')) self.assertTrue(ReferenceName('chr10') < ReferenceName('chr3'))
def test_prefixed_vs_naked_str(self): self.assertEqual('1', ReferenceName('chr1')) self.assertNotEqual('2', ReferenceName('chr1')) self.assertTrue(ReferenceName('chr1') == '1')