def test_simple_test(self):
        simple_test_lines = ['{simple}']

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '{', simple_test_lines)
        self.assertTrue(start == 0, 'didn\'t identify start index')
        self.assertTrue(start_line == 0, 'didn\'t identify start line')
        self.assertTrue(end == 7, 'didn\'t identify end index')
        self.assertTrue(end_line == 0, 'didn\'t identify end line')
Example #2
0
    def simple_test(self):
        simple_test_lines = ['{simple}']

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '{', simple_test_lines)
        assert start==0, 'didn\'t identify start index'
        assert start_line==0, 'didn\'t identify start line'
        assert end==8, 'didn\'t identify end index'
        assert end_line==0, 'didn\'t identify end line'
Example #3
0
    def test_hanging_braces(self):
        """plotextractor - find_open_and_close_braces hanging braces"""
        hanging_braces_lines = ['line{and stuff', 'and more stuff', 'and more']

        start, start_line, end, end_line = find_open_and_close_braces(
            0, 0, '{', hanging_braces_lines)
        self.assertTrue(start == 4, 'didn\'t identify start index')
        self.assertTrue(start_line == 0, 'didn\'t identify start line')
        self.assertTrue(end == 4, 'didn\'t identify end index')
        self.assertTrue(end_line == 0, 'didn\'t identify end line')
Example #4
0
    def test_square_braces(self):
        """plotextractor - find_open_and_close_braces square braces"""
        square_brace_lines = ['[squaaaaaaare braces]']

        start, start_line, end, end_line = find_open_and_close_braces(
            0, 0, '[', square_brace_lines)
        self.assertTrue(start == 0, 'didn\'t identify start index')
        self.assertTrue(start_line == 0, 'didn\'t identify start line')
        self.assertTrue(end == 20, 'didn\'t identify end index')
        self.assertTrue(end_line == 0, 'didn\'t identify end line')
Example #5
0
    def test_braces_start_on_next_line_test(self):
        """plotextractor - find_open_and_close_braces next line"""
        start_on_next_line_lines = ['nothing here', 'chars{morestuff', 'last}']

        start, start_line, end, end_line = find_open_and_close_braces(
            0, 0, '{', start_on_next_line_lines)
        self.assertTrue(start == 5, 'didn\'t identify start index')
        self.assertTrue(start_line == 1, 'didn\'t identify start line')
        self.assertTrue(end == 4, 'didn\'t identify end index')
        self.assertTrue(end_line == 2, 'didn\'t identify end line')
Example #6
0
    def test_simple_test(self):
        """plotextractor - find_open_and_close_braces simple"""
        simple_test_lines = ['{simple}']

        start, start_line, end, end_line = find_open_and_close_braces(
            0, 0, '{', simple_test_lines)
        self.assertTrue(start == 0, 'didn\'t identify start index')
        self.assertTrue(start_line == 0, 'didn\'t identify start line')
        self.assertTrue(end == 7, 'didn\'t identify end index')
        self.assertTrue(end_line == 0, 'didn\'t identify end line')
Example #7
0
    def test_unacceptable_braces(self):
        """plotextractor - find_open_and_close_braces unacceptable braces"""
        empty_lines = []

        start, start_line, end, end_line = find_open_and_close_braces(
            0, 0, '?', empty_lines)
        self.assertTrue(start == -1, 'didn\'t identify non-brace')
        self.assertTrue(start_line == -1, 'didn\'t identify non-brace')
        self.assertTrue(end == -1, 'didn\'t identify non-brace')
        self.assertTrue(end_line == -1, 'didn\'t identify non-brace')
Example #8
0
    def unacceptable_braces(self):
        empty_lines = []

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '?',
                                               empty_lines)
        assert start==-1, 'didn\'t identify non-brace'
        assert start_line==-1, 'didn\'t identify non-brace'
        assert end==-1, 'didn\'t identify non-brace'
        assert end_line==-1, 'didn\'t identify non-brace'
    def test_simple_test(self):
        """plotextractor - find_open_and_close_braces simple"""
        simple_test_lines = ['{simple}']

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '{', simple_test_lines)
        self.assertTrue(start == 0, "didn't identify start index")
        self.assertTrue(start_line == 0, "didn't identify start line")
        self.assertTrue(end == 7, "didn't identify end index")
        self.assertTrue(end_line == 0, "didn't identify end line")
Example #10
0
    def square_braces(self):
        square_brace_lines = ['[squaaaaaaare braces]']

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '[',
                                               square_brace_lines)
        assert start==0, 'didn\'t identify start index'
        assert start_line==0, 'didn\'t identify start line'
        assert end==20, 'didn\'t identify end index'
        assert end_line==0, 'didn\'t identify end line'
Example #11
0
    def hanging_braces(self):
        hanging_braces_lines = ['line{and stuff', 'and more stuff', 'and more']

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '{',
                                               hanging_braces_lines)
        assert start==4, 'didn\'t identify start index'
        assert start_line==0, 'didn\'t identify start line'
        assert end==4, 'didn\'t identify end index'
        assert end_line==0, 'didn\'t identify end line'
Example #12
0
    def braces_start_on_next_line_test(self):
        start_on_next_line_lines = ['nothing here', 'chars{morestuff', 'last}']

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '{',
                                               start_on_next_line_lines)
        assert start==5, 'didn\'t identify start index'
        assert start_line==1, 'didn\'t identify start line'
        assert end==4, 'didn\'t identify end index'
        assert end_line==2, 'didn\'t identify end line'
    def test_unacceptable_braces(self):
        empty_lines = []

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '?',
                                               empty_lines)
        self.assertTrue(start == -1, 'didn\'t identify non-brace')
        self.assertTrue(start_line == -1, 'didn\'t identify non-brace')
        self.assertTrue(end == -1, 'didn\'t identify non-brace')
        self.assertTrue(end_line == -1, 'didn\'t identify non-brace')
    def test_square_braces(self):
        square_brace_lines = ['[squaaaaaaare braces]']

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '[',
                                               square_brace_lines)
        self.assertTrue(start == 0, 'didn\'t identify start index')
        self.assertTrue(start_line == 0, 'didn\'t identify start line')
        self.assertTrue(end == 20, 'didn\'t identify end index')
        self.assertTrue(end_line == 0, 'didn\'t identify end line')
Example #15
0
    def confounding_braces(self):
        confounding_braces_lines = ['{brace{bracebrace}{}', 'brace{{brace}',
                                   'brace}', '}']

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '{',
                                               confounding_braces_lines)
        assert start==0, 'didn\'t identify start index'
        assert start_line==0, 'didn\'t identify start line'
        assert end==0, 'didn\'t identify end index'
        assert end_line==3, 'didn\'t identify end line'
    def test_unacceptable_braces(self):
        """plotextractor - find_open_and_close_braces unacceptable braces"""
        empty_lines = []

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '?',
                                               empty_lines)
        self.assertTrue(start == -1, "didn't identify non-brace")
        self.assertTrue(start_line == -1, "didn't identify non-brace")
        self.assertTrue(end == -1, "didn't identify non-brace")
        self.assertTrue(end_line == -1, "didn't identify non-brace")
    def test_hanging_braces(self):
        """plotextractor - find_open_and_close_braces hanging braces"""
        hanging_braces_lines = ['line{and stuff', 'and more stuff', 'and more']

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '{',
                                               hanging_braces_lines)
        self.assertTrue(start == 4, 'didn\'t identify start index')
        self.assertTrue(start_line == 0, 'didn\'t identify start line')
        self.assertTrue(end == 4, 'didn\'t identify end index')
        self.assertTrue(end_line == 0, 'didn\'t identify end line')
    def test_square_braces(self):
        """plotextractor - find_open_and_close_braces square braces"""
        square_brace_lines = ['[squaaaaaaare braces]']

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '[',
                                               square_brace_lines)
        self.assertTrue(start == 0, "didn't identify start index")
        self.assertTrue(start_line == 0, "didn't identify start line")
        self.assertTrue(end == 20, "didn't identify end index")
        self.assertTrue(end_line == 0, "didn't identify end line")
    def test_braces_start_on_next_line_test(self):
        """plotextractor - find_open_and_close_braces next line"""
        start_on_next_line_lines = ['nothing here', 'chars{morestuff', 'last}']

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '{',
                                               start_on_next_line_lines)
        self.assertTrue(start == 5, 'didn\'t identify start index')
        self.assertTrue(start_line == 1, 'didn\'t identify start line')
        self.assertTrue(end == 4, 'didn\'t identify end index')
        self.assertTrue(end_line == 2, 'didn\'t identify end line')
    def test_confounding_braces(self):
        """plotextractor - find_open_and_close_braces confounding"""
        confounding_braces_lines = ['{brace{bracebrace}{}', 'brace{{brace}',
                                   'brace}', '}']

        start, start_line, end, end_line = find_open_and_close_braces(
                                               0, 0, '{',
                                               confounding_braces_lines)
        self.assertTrue(start == 0, 'didn\'t identify start index')
        self.assertTrue(start_line == 0, 'didn\'t identify start line')
        self.assertTrue(end == 0, 'didn\'t identify end index')
        self.assertTrue(end_line == 3, 'didn\'t identify end line')
Example #21
0
    def test_confounding_braces(self):
        """plotextractor - find_open_and_close_braces confounding"""
        confounding_braces_lines = [
            '{brace{bracebrace}{}', 'brace{{brace}', 'brace}', '}'
        ]

        start, start_line, end, end_line = find_open_and_close_braces(
            0, 0, '{', confounding_braces_lines)
        self.assertTrue(start == 0, 'didn\'t identify start index')
        self.assertTrue(start_line == 0, 'didn\'t identify start line')
        self.assertTrue(end == 0, 'didn\'t identify end index')
        self.assertTrue(end_line == 3, 'didn\'t identify end line')