Exemplo n.º 1
0
    def test_contained_in_5(self):
        start = SourcePosition('a.py', line=3, column=5)
        end = SourcePosition('a.py', line=5, column=1)
        smaller = SourceRange(start, end)

        start = SourcePosition('a.py', line=2, column=5)
        end = SourcePosition('a.py', line=5, column=1)
        bigger = SourceRange(start, end)
        self.assertTrue(contained_in(smaller, bigger))

        start = SourcePosition('a.py', line=3, column=8)
        end = SourcePosition('a.py', line=7, column=1)
        bigger = SourceRange(start, end)
        self.assertFalse(contained_in(smaller, bigger))
Exemplo n.º 2
0
    def test_contained_in_2(self):
        start = SourcePosition('a.py', line=1, column=5)
        end = SourcePosition('a.py', line=5, column=1)
        smaller = SourceRange(start, end)

        start = SourcePosition('a.py', line=1, column=9)
        end = SourcePosition('a.py', line=5, column=1)
        bigger = SourceRange(start, end)
        self.assertFalse(contained_in(smaller, bigger))

        start = SourcePosition('a.py', line=1, column=6)
        end = SourcePosition('a.py', line=4, column=2)
        bigger = SourceRange(start, end)
        self.assertFalse(contained_in(smaller, bigger))

        start = SourcePosition('b.py', line=1, column=5)
        end = SourcePosition('b.py', line=5, column=1)
        bigger = SourceRange(start, end)
        self.assertFalse(contained_in(smaller, bigger))
def check_bear_results(ret_val, ignore_ranges):
    if len(ret_val) == 0:
        return True
    elif len(ignore_ranges) == 0:
        return False
    # Check whether all the results lie in an ignore_ranges object
    for result in ret_val:
        for ignores in ignore_ranges:
            for range_object in result.affected_code:
                if not contained_in(range_object, ignores[1]):
                    return False
    return True
Exemplo n.º 4
0
def check_bear_results(ret_val, ignore_ranges):
    if len(ret_val) == 0:
        return True
    elif len(ignore_ranges) == 0:
        return False
    # Check whether all the results lie in an ignore_ranges object
    for result in ret_val:
        for ignores in ignore_ranges:
            for range_object in result.affected_code:
                if not contained_in(range_object, ignores[1]):
                    return False
    return True