Beispiel #1
0
    def test_alternate_orderings(self):
        loc = build_compound([(0, 3), (6, 9), (12, 15)], -1)
        assert loc.parts[0].start == 0
        assert is_bridged(loc)
        assert loc.parts[0].start == 0

        assert not is_bridged(loc, allow_reversing=True)
        assert loc.parts[0].start == 12

        loc = build_compound([(12, 15), (6, 9), (0, 3)], -1)
        assert loc.parts[0].start == 12
        assert not is_bridged(loc, allow_reversing=True)
        assert loc.parts[0].start == 12
Beispiel #2
0
    def test_unusable(self):
        # this format crosses the origin multiple times and can't be interpreted
        raw_loc_parts = [(0, 3), (6, 9), (12, 15), (18, 21)]
        # test a variety of badly ordered parts
        for ordering in [[0, 2, 1, 3], [0, 1, 3, 2], [0, 3, 1, 2]]:
            # cycle them around to test position independence
            for i in range(len(ordering)):
                loc_parts = [
                    raw_loc_parts[i] for i in ordering[i:] + ordering[:i]
                ]

                # forward
                loc = build_compound(loc_parts, 1)
                assert is_bridged(loc)
                with self.assertRaisesRegex(
                        ValueError, "cannot determine correct ordering"):
                    splitter(loc)

                # reverse
                loc = build_compound(loc_parts[::-1], -1)
                assert is_bridged(loc)
                with self.assertRaisesRegex(
                        ValueError, "cannot determine correct ordering"):
                    splitter(loc)
Beispiel #3
0
 def test_indeterminate(self):
     assert is_bridged(build_compound([(0, 3), (12, 15), (6, 9)], -1),
                       allow_reversing=True)
Beispiel #4
0
 def test_not_bridged(self):
     assert not is_bridged(build_compound([(1, 6), (5, 10)], 1))
     assert not is_bridged(build_compound([(5, 10), (1, 6)], -1))
Beispiel #5
0
 def test_bad_strand(self):
     pairs = [(9, 12), (0, 3)]
     assert is_bridged(build_compound(pairs, 1))
     assert not is_bridged(build_compound(pairs, None))
Beispiel #6
0
 def test_reverse(self):
     assert is_bridged(build_compound([(0, 3), (9, 12)], -1))
     assert is_bridged(build_compound([(6, 9), (0, 3), (15, 18)], -1))
     assert is_bridged(build_compound([(0, 3), (15, 18), (6, 9)], -1))
     assert not is_bridged(build_compound([(9, 12), (0, 3)], -1))
Beispiel #7
0
 def test_forward(self):
     assert is_bridged(build_compound([(9, 12), (0, 3)], 1))
     assert is_bridged(build_compound([(9, 12), (0, 3), (4, 5)], 1))
     assert is_bridged(build_compound([(4, 5), (9, 12), (0, 3)], 1))
     assert not is_bridged(build_compound([(0, 3), (9, 12)], 1))