---
# System prepended metadata

title: Software Testing 2022

---

# Software Testing 2022
[Midterm Presentation Slide](https://docs.google.com/presentation/d/1BNvzCAU-AFe7dv5KwQXJqVix3bjKb0K35qoTjQGDRHg/edit?usp=sharing)
[Final Project Slide](https://docs.google.com/presentation/d/1F6jVtTycf7MSLwjpIzZfn54CMAU5qAVgKTSvbUMLIj8/edit#slide=id.p)
[Groupwork 3](https://docs.google.com/document/d/1WBHuCnHhDnXBJn-w6E9m_md22DBG9UsheCBfELU6ABg/edit?usp=sharing)
[Github](https://github.com/psf/black)
[Drive](https://drive.google.com/drive/folders/1gLVl_2TgvLeCVrIpGOZR8AHjiJVXrmcT?usp=sharing)
[Final Project Drive](https://drive.google.com/drive/folders/1dKtDkWYSXtcKvu9tsUKdMKWvmsnL7rUc?usp=sharing)
[Final Project Report](https://docs.google.com/document/d/1QZ8gQuqFVfxQhgwqdw065H-DplGZ5N8RxKv9mBY5AF4/edit?usp=sharing)

## Unit Testing
**source file:** //src/black/lines.py
**Testing tools:** Unitest


## Difficulties
- Hard to debug mock

## Special Case
- Hard to debug mock
- Infeasiable Test Requirement

## Coverage
```
$ pip install coverage
$ coverage run -m unittest discover
$ coverage html
```

---

### [lines.py](https://github.com/psf/black/blob/main/src/black/lines.py)
- [x] append
- [x] append_safe
- [x] is_comment
- [x] is_decorator
- [x] is_import
- [x] is_class
- [x] is_stub_class
- [x] is_def
- [x] is_class_paren_empty
- [x] is_triple_quoted_string
- [x] contains_standalone_comments
- [x] contains_uncollapsable_type_comments
- [x] contains_unsplittable_type_ignore
- [x] contains_multiline_strings
- [x] has_magic_trailing_comma
- [x] append_comment
- [x] comments_after
- [x] remove_trailing_comma
- [x] is_complex_subscript
- [x] enumerate_with_length
- [x] clone
- [x] __str__
- [x] __bool__


* **Line Class: append function** ([CFG](https://i.imgur.com/RBwLKDA.png))

```python=
class test_append(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge Coverage) for "append" Method in Line Class: ', end=' ')
        # pass

    def tearDown(self):
        print('')
        # pass

    def test_append_case1(self) -> None:
        # ALL Node and ALL Edge Coverage
        # 6 test paths are needed for Edge Coverage
        ## [1,2,4,6,7,8,9,12,15,10,14,3]
        ## [1,2,4,6,8,9,11,10,14,3]
        ## [1,2,4,6,7,8,9,12,10,3]
        ## [1,2,4,6,8,10,14,3]
        ## [1,2,4,5,6,8,9,11,13,10,14,3]
        ## [1,2,3]
        
        ## Test Path: [1, 2, 3]
        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = " ", type = 0)
        line.append(leaf = leaf)
        self.assertEqual(str(line), "\n")
        print("Test Path: [1, 2, 3] Completed")

    
    def test_append_case2(self) -> None:
        ## Test Path: [1, 2, 4, 5, 6, 8, 10, 14, 3]
        mode = Mode()
        line = Line(mode)

        ### is_class_paren_empty == True
        leaf0 = Leaf(value = "class", type = token.NAME)
        leaf1 = Leaf(value = " Car", type = token.STRING)
        leaf2 = Leaf(value = "(", type = token.LPAR)
        leaf3 = Leaf(value = ")", type = token.RPAR)
        line.leaves.append(leaf0)
        line.leaves.append(leaf1)
        line.leaves.append(leaf2)
        line.leaves.append(leaf3)

        leaf = Leaf(value = ":", type = token.COLON)
        line.append(leaf = leaf, preformatted = True)
        self.assertEqual(str(line), "class Car:\n")
        print("Test Path: [1, 2, 4, 5, 6, 8, 10, 14, 3] Completed")


    def test_append_case3(self) -> None:
        ## Test Path: [1, 2, 4, 6, 8, 9, 11, 10, 14, 3]
        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "hello", type = token.STRING)
        line.append(leaf = leaf)
        self.assertEqual(str(line), "hello\n")
        print("Test Path: [1, 2, 4, 6, 8, 9, 11, 10, 14, 3] Completed")


    def test_append_case4(self) -> None:
        ## Test Path: [1, 2, 4, 6, 7, 8, 9, 12, 10, 3]
        mode = Mode(magic_trailing_comma = False)
        line = Line(mode)

        leaf0 = Leaf(value = "# comment1", type = token.COMMENT)
        line.leaves.append(leaf0)
        leaf = Leaf(value = "comment2", type = token.COMMENT)
        line.append(leaf = leaf, preformatted = False)
        self.assertEqual(str(line), "# comment1  comment2\n")
        print("Test Path: [1, 2, 4, 6, 7, 8, 9, 12, 10, 3] Completed")


    def test_append_case5(self) -> None:
        ## Test Path: [1, 2, 4, 6, 7, 8, 9, 12, 15, 10, 14, 3]
        mode = Mode(magic_trailing_comma = False)
        line = Line(mode)

        leaf0 = Leaf(value = "[", type = token.LBRACE)
        leaf1 = Leaf(value = ",", type = token.COMMA)
        line.append(leaf = leaf0)
        line.append(leaf = leaf1)
        leaf = Leaf(value = "]", type = token.RBRACE)
        line.append(leaf = leaf)
        self.assertEqual(str(line), "[]\n")
        print("Test Path: [1, 2, 4, 6, 7, 8, 9, 12, 15, 10, 14, 3] Completed")


    def test_append_case6(self) -> None:
        ## Test Path: [1, 2, 4, 5, 6, 8, 9, 11, 13, 10, 14, 3]
        mode = Mode()
        line = Line(mode)

        leaf0 = Leaf(value = "[", type = token.LBRACE)
        leaf1 = Leaf(value = ",", type = token.COMMA)
        line.append(leaf = leaf0)
        line.append(leaf = leaf1)
        leaf = Leaf(value = "]", type = token.RBRACE)
        line.append(leaf = leaf)
        self.assertEqual(str(line), "[,]\n")
        print("Test Path: [1, 2, 4, 5, 6, 8, 9, 11, 13, 10, 14, 3] Completed")
```
---

* * **Line Class: append_safe function** ([CFG](https://i.imgur.com/et01iqj.png))

```python=
class TestAppendSafe(unittest.TestCase):
    # Case 1: [1,2,4,5,7]
    def test_append_safe_case1(self) -> None:
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value="Blackie", type=token.NAME)
        leaf1 = Leaf(value="# Comment", type=153)

        line.append(leaf0)
        with self.assertRaisesRegex(
            ValueError, "cannot append standalone comments to a populated line"
        ):
            line.append_safe(leaf1)

    # Case 2: [1,2,3]
    def test_append_safe_case2(self) -> None:
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value="Class", type=token.NAME)
        line.bracket_tracker.depth = 1
        line.append = mock.Mock(return_value=None)
        line.append_safe(leaf0)
        line.append.assert_called_once()

    # Case 3: [1,2,4,6]
    def test_append_safe_case3(self) -> None:
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value="# Comment", type=153)
        leaf1 = Leaf(value="Blackie", type=token.STRING)

        line.append_safe(leaf0)
        with self.assertRaisesRegex(ValueError, "cannot append to standalone comments"):
            line.append_safe(leaf1)

    # Case 4: [1,2,4,5,3]
    def test_append_safe_case4(self) -> None:
        mode = Mode()
        leaf0 = Leaf(value="Blackie", type=token.NAME)

        with mock.patch(
            "black.Line.is_comment", new_callable=mock.PropertyMock
        ) as mock_is_comment:
            mock_is_comment.return_value = False
            line = Line(mode)
            line.append = mock.Mock(return_value=None)
            line.append_safe(leaf0)
            line.append.assert_called_once()
```

---

* **Line Class: is_comment property** ([CFG](https://i.imgur.com/GsBpjkM.png))

```python=
class test_is_comment(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "is_comment" Property in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test_is_comment_case1(self) -> None:
        print("Case 1")

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "comment1", type = STANDALONE_COMMENT)
        line.leaves.append(leaf)
        r = line.is_comment
        self.assertTrue(r)
        print("Test Path: [1, 2] completed")


    def test_is_comment_case2(self) -> None:
        print("Case 2")

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "comment1", type = token.STRING)
        line.leaves.append(leaf)
        r = line.is_comment
        self.assertFalse(r)
        print("Test Path: [1, 3] completed")
```

---

* **Line Class: is_decorator property** ([CFG](https://i.imgur.com/z9ury7p.png))

```python=
class test_is_decorator(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "is_decorator" Property in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test_is_decorator_case1(self) -> None:
        print("Case 1")

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "@", type = token.AT)
        line.leaves.append(leaf)
        
        r = line.is_decorator
        self.assertTrue(r)
        print("Test Path: [1, 2] completed")


    def test_is_decorator_case2(self) -> None:
        print("Case 2")

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "comment1", type = token.STRING)
        line.leaves.append(leaf)

        r = line.is_decorator
        self.assertFalse(r)
        print("Test Path: [1, 3] completed")
```

---

* **Line Class: is_import property** ([CFG](https://i.imgur.com/qMYT0iN.png))

```python=
class test_is_import(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "is_import" Property in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    @mock.patch('black.nodes.is_import')
    def test_is_import_case1(self, mock_is_import) -> None:
        print("Case 1")

        mode = Mode()
        line = Line(mode)

        leaf = Leaf(value = "import", type = token.NAME)
        node = Node(type = syms.import_name, children=[leaf])
        leaf.parent = node
        line.leaves.append(leaf)
        
        r = line.is_import
        self.assertTrue(r)
        print("Test Path: [1, 2] completed")

    
    def test_is_import_case2(self) -> None:
        print("Case 2")

        mode = Mode()
        line = Line(mode)

        leaf = Leaf(value = "impo", type = token.STRING)
        node = Node(type = syms.import_name, children=[leaf])
        leaf.parent = node
        line.leaves.append(leaf)
        
        r = line.is_import
        self.assertFalse(r)
        print("Test Path: [1, 3] completed")
```
---

* **Line Class: is_class property** ([CFG](https://i.imgur.com/1gDTo6Z.png))

```python=
class test_is_class(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "is_class" Property in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test_is_class_case1(self) -> None:
        print("Case 1")

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "class", type = token.NAME)
        line.leaves.append(leaf)
        
        r = line.is_class
        self.assertTrue(r)
        print("Test Path: [1, 2] completed")


    def test_is_class_case2(self) -> None:
        print("Case 2")

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "class", type = token.STRING)
        line.leaves.append(leaf)

        r = line.is_class
        self.assertFalse(r)
        print("Test Path: [1, 3] completed")
```

---

* **Line Class: is_stub_class property** ([CFG](https://i.imgur.com/Iuxz2zN.png))

```python=
class test_is_stub_class(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "is_stub_class" Property in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test_is_stub_class_case1(self) -> None:
        print("Case 1")

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "class", type = token.NAME)
        line.leaves.append(leaf)
        leaf0 = Leaf(value = ".", type = token.DOT)
        line.leaves.append(leaf0)
        line.leaves.append(leaf0)
        line.leaves.append(leaf0)

        r = line.is_stub_class
        self.assertTrue(r)
        print("Test Path: [1, 2] completed")


    def test_is_stub_class_case2(self) -> None:
        print("Case 2")

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "class", type = token.NAME)
        line.leaves.append(leaf)

        r = line.is_stub_class
        self.assertFalse(r)
        print("Test Path: [1, 3] completed")
```

---

* **Line Class: is_def property** ([CFG](https://i.imgur.com/T0Di59U.png))

```python=
class test_is_def(unittest.TestCase):
    # [1, 2, 5, 4, 6]
    # [1, 2, 4, 6]
    # [1, 2, 4, 7, 8]
    # [1, 2, 5, 4, 7, 9]
    # [1, 3]

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "is_def" Property in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test_is_def_case1(self) -> None:
        print("Case 1")

        # Test Path: [1, 3]

        mode = Mode()
        line = Line(mode)
        
        r = line.is_def
        self.assertFalse(r)
        print("Test Path: [1, 3] completed")


    def test_is_def_case2(self) -> None:
        print("Case 2")

        # Test Paht: [1, 2, 4, 6]

        mode = Mode()
        line = Line(mode)

        leaf0 = Leaf(value = "def", type = token.NAME)
        leaf1 = Leaf(value = "sort", type = token.STRING)
        line.leaves.append(leaf0)
        line.leaves.append(leaf1)

        r = line.is_def
        self.assertTrue(r)
        print("Test Path: [1, 2, 4, 6] completed")


    def test_is_def_case3(self) -> None:
        print("Case 3")

        # Test Paht: [1, 2, 4, 7, 8]

        mode = Mode()
        line = Line(mode)

        leaf0 = Leaf(value = "async", type = token.ASYNC)
        leaf1 = Leaf(value = "def", type = token.NAME)
        line.leaves.append(leaf0)
        line.leaves.append(leaf1)

        r = line.is_def
        self.assertTrue(r)
        print("Test Path: [1, 2, 4, 7, 8] completed")


    def test_is_def_case4(self) -> None:
        print("Case 4")

        # Test Paht: [1, 2, 5, 4, 6]

        mode = Mode()
        line = Line(mode)

        leaf0 = Leaf(value = "def", type = token.NAME)
        line.leaves.append(leaf0)

        r = line.is_def
        self.assertTrue(r)
        print("Test Path: [1, 2, 5, 4, 6] completed")


    def test_is_def_case5(self) -> None:
        print("Case 5")

        # Test Paht: [1, 2, 5, 4, 7, 9]

        mode = Mode()
        line = Line(mode)

        leaf0 = Leaf(value = "sort", type = token.STRING)
        line.leaves.append(leaf0)

        r = line.is_def
        self.assertFalse(r)
        print("Test Path: [1, 2, 5, 4, 7, 9] completed")
```

---

* **Line Class: is_class_paren_empty property** ([CFG](https://i.imgur.com/jIDcn0Z.png))

```python=
class test_is_class_paren_empty(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "is_class_paren_empty" Property in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test_is_class_paren_empty_case1(self) -> None:
        print("Case 1")

        mode = Mode()
        line = Line(mode)
        
        leaf0 = Leaf(value = "class", type = token.NAME)
        leaf1 = Leaf(value = "vehicle", type = token.STRING)
        leaf2 = Leaf(value = "(", type = token.LPAR)
        leaf3 = Leaf(value = ")", type = token.RPAR)
        line.leaves.append(leaf0)
        line.leaves.append(leaf1)
        line.leaves.append(leaf2)
        line.leaves.append(leaf3)

        r = line.is_class_paren_empty
        self.assertTrue(r)
        print("Test Path: [1, 2] completed")



    def test_is_class_paren_empty_case2(self) -> None:
        print("Case 2")

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "comment1", type = token.STRING)
        line.leaves.append(leaf)

        r = line.is_class_paren_empty
        self.assertFalse(r)
        print("Test Path: [1, 3] completed")
```
---

* **Line Class: is_triple_quoted_string property** ([CFG](https://i.imgur.com/6vm9DUB.png))

```python=
class test_is_triple_quoted_string(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "is_triple_quoted_string" Property in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test_is_triple_quoted_string_case1(self) -> None:
        print("Case 1")

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "\"\"\" hello word", type = token.STRING)
        line.leaves.append(leaf)
        
        r = line.is_triple_quoted_string
        self.assertTrue(r)
        print("Test Path: [1, 2] completed")


    def test_is_triple_quoted_string_case2(self) -> None:
        print("Case 2")

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "comment1", type = token.STRING)
        line.leaves.append(leaf)

        r = line.is_triple_quoted_string
        self.assertFalse(r)
        print("Test Path: [1, 3] completed")
```

---

* **Line Class: contains_standalone_comments function** ([CFG](https://i.imgur.com/Qq6uneP.png))

```python=
class test_contains_standalone_comments(unittest.TestCase):
    # [1, 2, 4]
    # [1, 2, 3, 5]
    # [1, 2, 3, 2, 4]
    # [1, 2, 3, 2, 3, 2, 4]

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "contains_standalone_comments" Function in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test_contains_standalone_comments_case1(self) -> None:
        print("Case 1")

        # Test Path: [1, 2, 4]
        mode = Mode()
        line = Line(mode)

        r = line.contains_standalone_comments()
        self.assertFalse(r)
        print("Test Path: [1, 2, 4] completed")


    def test_contains_standalone_comments_case2(self) -> None:
        print("Case 2")

        # Test Path: [1, 2, 3, 5]
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value = "# comment", type = STANDALONE_COMMENT)
        leaf0.bracket_depth = 1
        line.leaves.append(leaf0)

        r = line.contains_standalone_comments()
        self.assertTrue(r)
        print("Test Path: [1, 2, 3, 5] completed")


    def test_contains_standalone_comments_case3(self) -> None:
        print("Case 3")

        # Test Path: [1, 2, 3, 2, 4]
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value = "comment", type = token.STRING)
        leaf0.bracket_depth = 1
        line.leaves.append(leaf0)

        r = line.contains_standalone_comments()
        self.assertFalse(r)
        print("Test Path: [1, 2, 3, 2, 4] completed")


    def test_contains_standalone_comments_case4(self) -> None:
        print("Case 4")

        # Test Path: [1, 2, 3, 2, 3, 2, 4]
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value = "comment", type = token.STRING)
        leaf0.bracket_depth = 1
        leaf1 = Leaf(value = "HELLO", type = token.STRING)
        leaf1.bracket_depth = 1
        line.leaves.append(leaf0)
        line.leaves.append(leaf1)

        r = line.contains_standalone_comments()
        self.assertFalse(r)
        print("Test Path: [1, 2, 3, 2, 3, 2, 4] completed")
```

---
* **Line Class: contains_uncollapsable_type_comments function** ([CFG](https://i.imgur.com/OnSQDvB.png))

```python=
class Test_contain_uncollapable_type_comments(unittest.TestCase):
    # [1,2,3,4,7,8,10,12,14,13,10,12,14,13,10,11,8,9]
    def test_append_safe_case1(self) -> None:
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value="# type: ignore", type=token.COMMENT)

        line.comments.setdefault(id(0), []).append(leaf0)
        self.assertFalse(line.contains_uncollapsable_type_comments())


    # [1,2,3,4,7,8,10,11,8,10,12,13,10,12,14,15]
    def test_contain_uncollapsable_test2(self) -> None:
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value="# type: ignore", type=token.COMMENT)
        leaf1 = Leaf(value="# type:", type=token.COMMENT)
        

        line.comments.setdefault(id(0), []).append(leaf0)
        line.comments.setdefault(id(1), []).append(leaf0)
        # print(is_type_comment(leaf0, " ignore"))
        # print(is_type_comment(leaf1, " ignore"))
        line.append(leaf1)
        self.assertTrue(line.contains_uncollapsable_type_comments())

    # [1,2,3,4,6,7,8,9]
    def test_contain_uncollapsable_test3(self) -> None:
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value="Blackie", type=token.COMMA)
        leaf1 = Leaf(value="Blackie", type=token.COMMA)

        line.append_safe(leaf0)
        line.append_safe(leaf1)
        self.assertEqual(0, len(line.comments.items()))
        self.assertFalse(line.contains_uncollapsable_type_comments())

    # [1,2,3,5]
    def test_contain_uncollapsable_test4(self) -> None:
        mode = Mode()
        line = Line(mode)
        self.assertFalse(line.contains_uncollapsable_type_comments())
```
---

* **Line Class: contains_unsplittable_type_ignore function** ([CFG](https://i.imgur.com/ln0jRmr.png))

```python=
class test_contains_unsplittable_type_ignore(unittest.TestCase):
    # [1, 2]
    # [1, 3, 4, 6]
    # [1, 3, 4, 5, 7, 6] not possible
    # [1, 3, 4, 5, 7, 8, 9, 11]
    # [1, 3, 4, 5, 7, 8, 12, 7, 8, 12, 7, 6]
    # [1, 3, 4, 5, 7, 8, 12, 7, 8, 9, 12, 7, 6]


    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "contains_unsplittable_type_ignore" Function in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test_contains_unsplittable_type_ignore_case1(self) -> None:
        print("Case 1")

        # Test Path: [1, 2]
        mode = Mode()
        line = Line(mode)

        r = line.contains_unsplittable_type_ignore()
        self.assertFalse(r)
        print("Test Path: [1, 2] completed")


    def test_contains_unsplittable_type_ignore_case2(self) -> None:
        print("Case 2")

        # Test Path: [1, 3, 4, 6]
        mode = Mode()
        line = Line(mode)

        leaf0 = Leaf(value = "hello", type = token.STRING)
        leaf1 = Leaf(value = "# comment", type = token.COMMENT)
        leaf0.lineno = 1
        leaf1.lineno = 2
        line.leaves.append(leaf0)
        line.leaves.append(leaf1)

        r = line.contains_unsplittable_type_ignore()
        self.assertFalse(r)
        print("Test Path: [1, 3, 4, 6] completed")


    def test_contains_unsplittable_type_ignore_case3(self) -> None:
        print("Case 3")

        # Test Path: [1, 3, 4, 5, 7, 8, 12, 7, 8, 12, 7, 6]
        mode = Mode()
        line = Line(mode)

        leaf0 = Leaf(value = "hello", type = token.STRING)
        leaf1 = Leaf(value = "# comment", type = token.COMMENT)
        line.leaves.append(leaf0)
        line.leaves.append(leaf1)

        r = line.contains_unsplittable_type_ignore()
        self.assertFalse(r)
        print("Test Path: [1, 3, 4, 5, 7, 8, 12, 7, 8, 12, 7, 6] completed")


    def test_contains_unsplittable_type_ignore_case4(self) -> None:
        print("Case 4")

        # Test Path: [1, 3, 4, 5, 7, 8, 9, 11]
        mode = Mode()
        line = Line(mode)

        leaf0 = Leaf(value = "hello", type = token.STRING)
        comment0 = Leaf(value = "# type: ignore", type = token.COMMENT)
        line.comments.setdefault(id(leaf0), []).append(comment0)
        line.leaves.append(leaf0)

        r = line.contains_unsplittable_type_ignore()
        self.assertTrue(r)
        print("Test Path: [1, 3, 4, 5, 7, 8, 9, 11] completed")


    def test_contains_unsplittable_type_ignore_case5(self) -> None:
        print("Case 5")

        # Test Path: [1, 3, 4, 5, 7, 8, 12, 7, 8, 9, 12, 7, 6]
        mode = Mode()
        line = Line(mode)

        leaf0 = Leaf(value = "hello", type = token.STRING)
        leaf1 = Leaf(value = "world", type = token.STRING)
        comment0 = Leaf(value = "# type:ignore", type = token.COMMENT)
        line.comments.setdefault(id(leaf0), []).append(comment0)
        line.leaves.append(leaf1)
        line.leaves.append(leaf0)

        r = line.contains_unsplittable_type_ignore()
        self.assertFalse(r)
        print("Test Path: [1, 3, 4, 5, 7, 8, 12, 7, 8, 9, 12, 7, 6] completed")
```

---
* **Line Class: contains_multiline_strings function** ([CFG](https://i.imgur.com/m6cj5Vs.png))

```python=
class test_contains_multiline_strings_class(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "contains_multiline_strings" Function in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test_contains_multiline_strings_case1(self) -> None:
        print("Case 1")

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = '"""\n', type = token.STRING)
        line.leaves.append(leaf)
        
        r = line.contains_multiline_strings()
        self.assertTrue(r)
        print("Test Path: [1, 2] completed")

    
    def test_contains_multiline_strings_case2(self) -> None:
        print("Case 2")

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "class", type = token.NAME)
        line.leaves.append(leaf)

        r = line.contains_multiline_strings()
        self.assertFalse(r)
        print("Test Path: [1, 3] completed")
```

---
* **Line Class: has_magic_trailing_comma function** ([CFG](https://i.imgur.com/9558jZC.png))

```python=
class test_has_magic_trailing_comma(unittest.TestCase):
    # [1, 2]
    # [1, 3, 4]
    # [1, 3, 5, 6, 8]
    # [1, 3, 5, 7, 14]
    # [1, 3, 5, 6, 9, 10]
    # [1, 3, 5, 7, 15, 17]
    # [1, 3, 5, 7, 15, 16]
    # [1, 3, 5, 6, 9, 11, 10]
    # [1, 3, 5, 6, 9, 11, 13]

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "has_magic_trailing_comma" Method in Line Class: ', end=' ')
        # pass

    def tearDown(self):
        print('')
        # pass

    def test_has_magic_trailing_comma_case1(self) -> None:
        print("Case 1")

        ## Test Path: [1, 2]
        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "str", type = token.STRING)

        r = line.has_magic_trailing_comma(leaf)
        self.assertFalse(r)
        print("Test Path: [1, 2] completed")


    def test_has_magic_trailing_comma_case2(self) -> None:
        print("Case 2")

        ## Test Path: [1, 3, 4]
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value = ",", type = token.COMMA)
        line.leaves.append(leaf0)

        leaf = Leaf(value = "]", type = token.RBRACE)

        r = line.has_magic_trailing_comma(leaf)
        self.assertTrue(r)
        print("Test Path: [1, 3, 4] completed")


    def test_has_magic_trailing_comma_case3(self) -> None:
        print("Case 3")

        ## Test Path: [1, 3, 5, 6, 8]
        mode = Mode(magic_trailing_comma=True, preview=True)
        line = Line(mode)
        leaf0 = Leaf(value = ",", type = token.COMMA)
        leaf0.bracket_depth = 1
        leaf1 = Leaf(value = "{", type = token.LSQB)
        leaf1.bracket_depth = 1
        leaf2 = Leaf(value = "}", type = token.RSQB)
        leaf2.bracket_depth = 1
        line.leaves.append(leaf1)
        line.leaves.append(leaf0)
        
        leaf = Leaf(value = "}", type = token.RSQB)
        node = Node(type = syms.trailer, children=[leaf])
        leaf.parent = node
        leaf.opening_bracket = leaf1
        leaf.bracket_depth = 1

        r = line.has_magic_trailing_comma(leaf)
        self.assertFalse(r)
        print("Test Path: [1, 3, 5, 6, 8] completed")

    
    def test_has_magic_trailing_comma_case4(self) -> None:
        print("Case 4")

        ## Test Path: [1, 3, 5, 6, 9, 10]
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value = ",", type = token.COMMA)
        line.leaves.append(leaf0)

        leaf = Leaf(value = "}", type = token.RSQB)
        node = Node(type = syms.trailer, children=[leaf])
        leaf.parent = node

        r = line.has_magic_trailing_comma(leaf)
        self.assertTrue(r)
        print("Test Path: [1, 3, 5, 6, 9, 10] completed")


    def test_has_magic_trailing_comma_case5(self) -> None:
        print("Case 5")

        ## Test Path: [1, 3, 5, 7, 14]
        with mock.patch('black.lines.Line.is_import', new_callable=mock.PropertyMock) as mock_is_import:
            mock_is_import.return_value = True

            mode = Mode()
            line = Line(mode)
            leaf = Leaf(value = "import", type = token.NAME)
            node = Node(type = syms.import_name, children=[leaf])
            leaf.parent = node
            line.leaves.append(leaf)
            leaf0 = Leaf(value = ",", type = token.COMMA)
            line.leaves.append(leaf0)

            leaf = Leaf(value = ")", type = token.RPAR)

            r = line.has_magic_trailing_comma(leaf)
            self.assertTrue(r)
            print("Test Path: [1, 3, 5, 7, 14] completed")
    

    def test_has_magic_trailing_comma_case6(self) -> None:
        print("Case 6")

        ## Test Path: [1, 3, 5, 7, 15, 17]
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value = ",", type = token.COMMA)
        line.leaves.append(leaf0)

        leaf = Leaf(value = ")", type = token.RPAR)

        r = line.has_magic_trailing_comma(leaf)
        self.assertFalse(r)
        print("Test Path: [1, 3, 5, 7, 15, 17] completed")


    def test_has_magic_trailing_comma_case7(self) -> None:
        print("Case 7")

        ## Test Path: [1, 3, 5, 7, 15, 16]
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value = ",", type = token.COMMA)
        line.leaves.append(leaf0)
        leaf1 = Leaf(value = "{", type = token.LSQB)
        leaf1.bracket_depth = 1

        leaf = Leaf(value = ")", type = token.RPAR)
        leaf.opening_bracket = leaf1
        leaf.bracket_depth = 1

        r = line.has_magic_trailing_comma(leaf)
        self.assertTrue(r)
        print("Test Path: [1, 3, 5, 7, 15, 16] completed")

    
    def test_has_magic_trailing_comma_case8(self) -> None:
        print("Case 8")

        ## Test Path: [1, 3, 5, 6, 9, 11, 13]
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value = ",", type = token.COMMA)
        line.leaves.append(leaf0)

        leaf = Leaf(value = "}", type = token.RSQB)
        node = Node(type = syms.trailer, children=[leaf])
        leaf.parent = node

        r = line.has_magic_trailing_comma(leaf, ensure_removable=True)
        self.assertFalse(r)
        print("Test Path: [1, 3, 5, 6, 9, 11, 13] completed")


    def test_has_magic_trailing_comma_case9(self) -> None:
        print("Case 9")

        ## Test Path: [1, 3, 5, 6, 9, 11, 10]
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value = ",", type = token.COMMA)
        node = Node(type = syms.listmaker, children=[leaf0])
        leaf0.parent = node
        line.leaves.append(leaf0)

        leaf = Leaf(value = "}", type = token.RSQB)
        node = Node(type = syms.trailer, children=[leaf])
        leaf.parent = node

        r = line.has_magic_trailing_comma(leaf, ensure_removable=True)
        self.assertTrue(r)
        print("Test Path: [1, 3, 5, 6, 9, 11, 10] completed")
```

---
* **Line Class: comments_after function** ([CFG](https://i.imgur.com/CvyMGrP.png))

```python=
class test_comments_after(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "comments_after" Function in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test_comments_after_case1(self) -> None:
        print("Case 1")

        mode = Mode()
        line = Line(mode)

        leaf0 = Leaf(value = "hello", type = token.STRING)
        comment0 = Leaf(value = "# type: ignore", type = token.COMMENT)
        line.comments.setdefault(id(leaf0), []).append(comment0)
        line.leaves.append(leaf0)

        r = line.comments_after(leaf0)
        self.assertEqual([comment0], r)
        print("Test Path: [1] completed (not None)")


    def test_comments_after_case2(self) -> None:
        print("Case 2")

        mode = Mode()
        line = Line(mode)

        leaf0 = Leaf(value = "hello", type = token.STRING)
        line.leaves.append(leaf0)

        r = line.comments_after(leaf0)
        self.assertEqual([], r)
        print("Test Path: [1] completed (None)")
```

---

* **Line Class: append_comment** ([CFG](https://i.imgur.com/akHu30p.png))

```python=
class TestAppendComment(unittest.TestCase):
# Case 1: [1,2,3]
    @mock.patch("black.brackets.BracketTracker.any_open_brackets")
    def test_append_comment_case1(self, mocked_tracker) -> None:
        print("Testing case1")
        mode = Mode()
        line = Line(mode)
        leaf1 = Leaf(value="# Comment", type=153)
        mocked_tracker.return_value = True

        # print(line.bracket_tracker.any_open_brackets())
        # print(leaf1.type == STANDALONE_COMMENT)
        self.assertFalse(line.append_comment(leaf1))


# Case 2: [1,2,4,5]
    def test_append_comment_case2(self) -> None:
        print("Testing case2")
        mode = Mode()
        line = Line(mode)
        leaf1 = Leaf(value="# Comment", type=token.STRING)

        self.assertFalse(line.append_comment(leaf1))


# Case 3: [1,2,4,6,7]
    def test_append_comment_case3(self) -> None:
        print("Testing case3")
        mode = Mode()
        line = Line(mode)
        leaf1 = Leaf(value="# Comment", type=token.COMMENT)

        self.assertFalse(line.append_comment(leaf1))

# Case 4: [1,2,4,6,8,9,11]
    def test_append_comment_case4(self) -> None:
        print("Testing case4")
        mode = Mode()
        line = Line(mode)
        leaf1 = Leaf(value="string", type=token.STRING)
        leaf2 = Leaf(value="# Comment", type=token.COMMENT)

        line.append(leaf1)
        self.assertTrue(line.append_comment(leaf2))


# Case 5: [1,2,4,6,8,9,10,13,11]
    @mock.patch("blib2to3.pytree.Leaf")
    @mock.patch("black.nodes.is_type_comment")
    def test_append_comment_case5(self, mocked_is_type_comment, mocked_leaf) -> None:  
        print("Testing case5")
        leaf1 = Leaf(value="(", type=token.LPAR)
        leaf2 = Leaf(value="# black", type=token.COMMENT)
        
        mocked_leaf.type = token.RPAR
        mocked_leaf.value = False
        mocked_leaf.parent.leaves.return_value = [None] * 2
        mocked_is_type_comment.return_value = False

        mode = Mode()
        line = Line(mode)
        line.append(leaf1, preformatted=True)
        line.append(mocked_leaf, preformatted=True)
        last_leaf = line.leaves[-1]

        self.assertFalse(len(line.leaves) < 2)
        self.assertEqual(last_leaf.type, token.RPAR)
        self.assertFalse(last_leaf.value)
        self.assertTrue(last_leaf.parent)
        self.assertTrue(len(list(last_leaf.parent.leaves())) <= 3)
        self.assertTrue(line.append_comment(leaf2))


# Case 6: [1,2,4,6,8,9,10,12]
    @mock.patch("blib2to3.pytree.Leaf")
    @mock.patch("black.nodes.is_type_comment")
    def test_append_comment_case6(self, mocked_is_type_comment, mocked_leaf) -> None:  
        print("Testing case6")
        leaf1 = Leaf(value="# black", type=token.COMMENT)
        
        mocked_leaf.type = token.RPAR
        mocked_leaf.value = False
        mocked_leaf.parent.leaves.return_value = [None] * 2
        mocked_is_type_comment.return_value = False

        mode = Mode()
        line = Line(mode)
        line.append(mocked_leaf, preformatted=True)
        last_leaf = line.leaves[-1]

        self.assertTrue(len(line.leaves) < 2)
        self.assertEqual(last_leaf.type, token.RPAR)
        self.assertFalse(last_leaf.value)
        self.assertTrue(last_leaf.parent)
        self.assertTrue(len(list(last_leaf.parent.leaves())) <= 3)
        self.assertFalse(line.append_comment(leaf1))
```
---

* **Line Class: remove_trailing_comma function** ([CFG](https://i.imgur.com/WuPUq2H.png))

```python=
class test_remove_trailing_comma(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "remove_trailing_comma" Function in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test_remove_trailing_comma_case1(self) -> None:
        print("Case 1")

        mode = Mode(magic_trailing_comma = False)
        line = Line(mode)

        leaf0 = Leaf(value = "[", type = token.LBRACE)
        leaf1 = Leaf(value = ",", type = token.COMMA)
        line.leaves.append(leaf0)
        line.leaves.append(leaf1)

        line.remove_trailing_comma()
        self.assertEqual(line.leaves, [leaf0])
        r = {id(leaf0): []}
        self.assertEqual(line.comments, r)

        print("Test Path: [1] completed")
```

---
* **Line Class: is_complex_subscript function** ([CFG](https://i.imgur.com/Ve0EeKs.png))

```python=
class test_is_complex_subscript(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "is_complex_subscript" Method in Line Class: ', end=' ')
        # pass

    def tearDown(self):
        print('')
        # pass

    def test_is_complex_subscript_case1(self) -> None:
        print("Case 1")

        ## Test Path: [1, 2, 4]
        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "str", type = token.STRING)
        r = line.is_complex_subscript(leaf)
        self.assertFalse(r)
        print("Test Path: [1, 2, 4] completed")

    
    @mock.patch('black.brackets.BracketTracker.get_open_lsqb')
    def test_is_complex_subscript_case2(self, mock_get_open_lsqb) -> None:
        print("Case 2")

        ## Test Path: [1, 3, 5, 10, 4]
        leaf0 = Leaf(value = "[", type = token.LBRACE)
        mock_get_open_lsqb.return_value = leaf0

        mode = Mode()
        line = Line(mode)
        leaf = Leaf(value = "]", type = token.RBRACE, prefix = None)
        r = line.is_complex_subscript(leaf)
        self.assertFalse(r)
        print("Test Path: [1, 3, 5, 10, 4] completed")
    

    @mock.patch('black.brackets.BracketTracker.get_open_lsqb')
    def test_is_complex_subscript_case3(self, mock_get_open_lsqb) -> None:
        print("Case 3")

        ## Test Path: [1, 3, 5, 6, 7, 4]
        leaf = Leaf(value = "[", type = token.LBRACE)
        leaf0 = Leaf(value = "str", type = token.STRING)
        node = Node(type = syms.listmaker, children=[leaf0])
        mock_get_open_lsqb.return_value = leaf
        with mock.patch('blib2to3.pytree.Base.next_sibling', new_callable=mock.PropertyMock) as mock_next_sibling:
            mock_next_sibling.return_value = node

            mode = Mode()
            line = Line(mode)
            r = line.is_complex_subscript(leaf)
            self.assertFalse(r)

        print("Test Path: [1, 3, 5, 6, 7, 4] completed")


    @mock.patch('blib2to3.pytree.Leaf.pre_order')
    @mock.patch('black.brackets.BracketTracker.get_open_lsqb')
    def test_is_complex_subscript_case4(self, mock_get_open_lsqb, mock_pre_order) -> None:
        print("Case 4")

        ## Test Path: [1, 3, 5, 10, 11]
        leaf = Leaf(value = "[", type = token.LBRACE)
        leaf0 = Leaf(value = "str", type = token.STRING)
        node = Node(type = syms.test, children=[leaf0])
        leaf0.parent = node
        mock_pre_order.return_value = [node]
        mock_get_open_lsqb.return_value = leaf
        with mock.patch('blib2to3.pytree.Base.next_sibling', new_callable=mock.PropertyMock) as mock_next_sibling:
            mock_next_sibling.return_value = leaf0

            mode = Mode()
            line = Line(mode)
            r = line.is_complex_subscript(leaf)
            self.assertTrue(r)

        print("Test Path: [1, 3, 5, 10, 11] completed")


    @mock.patch('blib2to3.pytree.Node.pre_order')
    @mock.patch('black.brackets.BracketTracker.get_open_lsqb')
    def test_is_complex_subscript_case5(self, mock_get_open_lsqb, mock_pre_order) -> None:
        print("Case 5")

        ## Test Path: [1, 3, 5, 6, 8, 10, 11]
        leaf = Leaf(value = "[", type = token.LBRACE)
        leaf0 = Leaf(value = "str", type = token.STRING)
        node = Node(type = syms.test, children=[leaf0])
        leaf0.parent = node
        mock_pre_order.return_value = [node]
        mock_get_open_lsqb.return_value = leaf
        with mock.patch('blib2to3.pytree.Base.next_sibling', new_callable=mock.PropertyMock) as mock_next_sibling:
            mock_next_sibling.return_value = node

            mode = Mode()
            line = Line(mode)
            r = line.is_complex_subscript(leaf)
            self.assertTrue(r)

        print("Test Path: [1, 3, 5, 6, 8, 10, 11] completed")


    @mock.patch('blib2to3.pytree.Node.pre_order')
    @mock.patch('black.brackets.BracketTracker.get_open_lsqb')
    def test_is_complex_subscript_case6(self, mock_get_open_lsqb, mock_pre_order) -> None:
        print("Case 6")

        ## Test Path: [1, 3, 5, 6, 8, 9, 10, 4]
        leaf = Leaf(value = "[", type = token.LBRACE)
        leaf0 = Leaf(value = "str", type = token.STRING)
        node = Node(type = syms.test, children=[leaf0])
        node1 = Node(type = syms.subscriptlist, children=[leaf])
        leaf.parent = node1
        leaf0.parent = node
        mock_pre_order.return_value = [node]
        mock_get_open_lsqb.return_value = leaf
        with mock.patch('blib2to3.pytree.Base.next_sibling', new_callable=mock.PropertyMock) as mock_next_sibling:
            mock_next_sibling.return_value = node1

            mode = Mode()
            line = Line(mode)
            r = line.is_complex_subscript(leaf)
            self.assertFalse(r)

        print("Test Path: [1, 3, 5, 6, 8, 9, 10, 4] completed")


    @mock.patch('black.brackets.BracketTracker.get_open_lsqb')
    def test_is_complex_subscript_case7(self, mock_get_open_lsqb) -> None:
        print("Case 7")

        ## Test Path: [1, 3, 5, 6, 8, 10, 4]
        leaf = Leaf(value = "[", type = token.LBRACE)
        leaf0 = Leaf(value = "str", type = token.STRING)
        node = Node(type = syms.tname, children=[leaf0])
        leaf0.parent = node
        mock_get_open_lsqb.return_value = leaf
        with mock.patch('blib2to3.pytree.Base.next_sibling', new_callable=mock.PropertyMock) as mock_next_sibling:
            mock_next_sibling.return_value = node

            mode = Mode()
            line = Line(mode)
            r = line.is_complex_subscript(leaf)
            self.assertFalse(r)

        print("Test Path: [1, 3, 5, 6, 8, 10, 4] completed")
```
--- 

* **Line Class: enumerate_with_length function** ([CFG](https://i.imgur.com/9TO8fnd.png))

```python=
class Test_enumerate_with_length(unittest.TestCase):
    # [1,2,3,4,5]	
    def test_anumerate_with_length_case1(self) -> None:
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value="Blackie \n", type=token.STRING)

        line.append(leaf0, preformatted=True)
        line.append(leaf0, preformatted=True)
        for index, leaf, leaf_length in line.enumerate_with_length():
            self.assertIsNone(index)
            self.assertIsNone(leaf)
            self.assertIsNone(leaf_length)


    # [2,3,4,6,7]
    # @mock.patch("lines.Line")	
    def test_anumerate_with_length_case2(self) -> None:
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value="Blackie", type=token.STRING)
        leaf1 = Leaf(value="# Comment", type=token.COMMENT)

        line.append(leaf0, preformatted=True)
        line.append(leaf0, preformatted=True)
        line.append(leaf1, preformatted=True)
        for index, leaf, leaf_length in line.enumerate_with_length():
            # print(index, leaf, leaf_length)
            self.assertIsNotNone(index)
            self.assertIsNotNone(leaf)
            self.assertIsNotNone(leaf_length) 
            self.assertEqual(leaf_length, len(leaf0.value) + len(leaf1.value))

```

* **Line Class: colne function** ([CFG](https://i.imgur.com/Nfbt6U3.png))
```python=
class Test_clone(unittest.TestCase):
    def test_clone_case1(self) -> None:
        mode = Mode()
        line = Line(mode)
        line2 = line.clone()

        self.assertEqual(line, line2)
```
---

* **Line Class: __str__ function** ([CFG](https://i.imgur.com/xEIj1rN.png))

```python=
class test___str__(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "__str__" Function in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test___str___case1(self) -> None:
        print("Case 1")

        # Test Path: [1, 2]
        mode = Mode()
        line = Line(mode)
        
        r = line.__str__()
        self.assertEqual("\n", r)
        print("Test Path: [1, 2] completed")


    def test___str___case2(self) -> None:
        print("Case 2")

        # Test Path: [1, 3, 4, 5, 4, 5, 4, 6, 8]
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value = "h", type = token.STRING)
        leaf1 = Leaf(value = "e", type = token.STRING)
        leaf2 = Leaf(value = "llo", type = token.STRING)
        line.leaves.append(leaf0)
        line.leaves.append(leaf1)
        line.leaves.append(leaf2)
        
        r = line.__str__()
        self.assertEqual("hello\n", r)
        print("Test Path: [1, 3, 4, 5, 4, 5, 4, 6, 8] completed")


    def test___str___case3(self) -> None:
        print("Case 3")

        # Test Path: [1, 3, 4, 6, 7, 6, 7, 6, 8]
        mode = Mode()
        line = Line(mode)

        leaf0 = Leaf(value = "hello", type = token.STRING)
        leaf1 = Leaf(value = "world", type = token.STRING)
        comment0 = Leaf(value = "# comment1", type = token.COMMENT)
        line.comments.setdefault(id(leaf0), []).append(comment0)
        line.leaves.append(leaf0)
        comment1 = Leaf(value = "# comment2", type = token.COMMENT)
        line.comments.setdefault(id(leaf1), []).append(comment1)
     
        r = line.__str__()
        self.assertEqual("hello# comment1# comment2\n", r)
        print("Test Path: [1, 3, 4, 6, 7, 6, 7, 6, 8] completed")
```

---

* **Line Class: __bool__ function** ([CFG](https://i.imgur.com/oCyNXZ7.png))

```python=
class test___bool__(unittest.TestCase):

    def setUp(self):
        print('Tests (Edge-Pair Coverage) for "__bool__" Function in Line Class: ', end=' ')
        

    def tearDown(self):
        print('')
    

    def test___bool___case1(self) -> None:
        print("Case 1")

        # Test Path: [1, 2]
        mode = Mode()
        line = Line(mode)
        leaf0 = Leaf(value = "h", type = token.STRING)
        line.leaves.append(leaf0)
        
        r = line.__bool__()
        self.assertTrue(r)
        print("Test Path: [1, 2] completed")


    def test___bool___case2(self) -> None:
        print("Case 2")

        # Test Path: [1, 3]
        mode = Mode()
        line = Line(mode)
        
        r = line.__bool__()
        self.assertFalse(r)
        print("Test Path: [1, 3] completed")
```

---