|
17 | 17 | TextPreChunk, |
18 | 18 | TextPreChunkAccumulator, |
19 | 19 | _TextSplitter, |
20 | | - is_in_next_section, |
21 | 20 | is_on_next_page, |
22 | 21 | is_title, |
23 | 22 | ) |
@@ -1514,68 +1513,6 @@ def but_it_does_not_generate_a_TextPreChunk_on_flush_when_empty(self): |
1514 | 1513 | # ================================================================================================ |
1515 | 1514 |
|
1516 | 1515 |
|
1517 | | -class Describe_is_in_next_section: |
1518 | | - """Unit-test suite for `unstructured.chunking.base.is_in_next_section()` function. |
1519 | | -
|
1520 | | - `is_in_next_section()` is not itself a predicate, rather it returns a predicate on Element |
1521 | | - (`Callable[[Element], bool]`) that can be called repeatedly to detect section changes in an |
1522 | | - element stream. |
1523 | | - """ |
1524 | | - |
1525 | | - def it_is_false_for_the_first_element_when_it_has_a_non_None_section(self): |
1526 | | - """This is an explicit first-section; first-section does not represent a section break.""" |
1527 | | - pred = is_in_next_section() |
1528 | | - assert not pred(Text("abcd", metadata=ElementMetadata(section="Introduction"))) |
1529 | | - |
1530 | | - def and_it_is_false_for_the_first_element_when_it_has_a_None_section(self): |
1531 | | - """This is an anonymous first-section; still doesn't represent a section break.""" |
1532 | | - pred = is_in_next_section() |
1533 | | - assert not pred(Text("abcd")) |
1534 | | - |
1535 | | - def it_is_false_for_None_section_elements_that_follow_an_explicit_first_section(self): |
1536 | | - """A `None` section element is considered to continue the prior section.""" |
1537 | | - pred = is_in_next_section() |
1538 | | - assert not pred(Text("abcd", metadata=ElementMetadata(section="Introduction"))) |
1539 | | - assert not pred(Text("efgh")) |
1540 | | - assert not pred(Text("ijkl")) |
1541 | | - |
1542 | | - def and_it_is_false_for_None_section_elements_that_follow_an_anonymous_first_section(self): |
1543 | | - """A `None` section element is considered to continue the prior section.""" |
1544 | | - pred = is_in_next_section() |
1545 | | - assert not pred(Text("abcd")) |
1546 | | - assert not pred(Text("efgh")) |
1547 | | - assert not pred(Text("ijkl")) |
1548 | | - |
1549 | | - def it_is_false_for_matching_section_elements_that_follow_an_explicit_first_section(self): |
1550 | | - pred = is_in_next_section() |
1551 | | - assert not pred(Text("abcd", metadata=ElementMetadata(section="Introduction"))) |
1552 | | - assert not pred(Text("efgh", metadata=ElementMetadata(section="Introduction"))) |
1553 | | - assert not pred(Text("ijkl", metadata=ElementMetadata(section="Introduction"))) |
1554 | | - |
1555 | | - def it_is_true_for_an_explicit_section_element_that_follows_an_anonymous_first_section(self): |
1556 | | - pred = is_in_next_section() |
1557 | | - assert not pred(Text("abcd")) |
1558 | | - assert not pred(Text("efgh")) |
1559 | | - assert pred(Text("ijkl", metadata=ElementMetadata(section="Introduction"))) |
1560 | | - |
1561 | | - def and_it_is_true_for_a_different_explicit_section_that_follows_an_explicit_section(self): |
1562 | | - pred = is_in_next_section() |
1563 | | - assert not pred(Text("abcd", metadata=ElementMetadata(section="Introduction"))) |
1564 | | - assert pred(Text("efgh", metadata=ElementMetadata(section="Summary"))) |
1565 | | - |
1566 | | - def it_is_true_whenever_the_section_explicitly_changes_except_at_the_start(self): |
1567 | | - pred = is_in_next_section() |
1568 | | - assert not pred(Text("abcd")) |
1569 | | - assert pred(Text("efgh", metadata=ElementMetadata(section="Introduction"))) |
1570 | | - assert not pred(Text("ijkl")) |
1571 | | - assert not pred(Text("mnop", metadata=ElementMetadata(section="Introduction"))) |
1572 | | - assert not pred(Text("qrst")) |
1573 | | - assert pred(Text("uvwx", metadata=ElementMetadata(section="Summary"))) |
1574 | | - assert not pred(Text("yzab", metadata=ElementMetadata(section="Summary"))) |
1575 | | - assert not pred(Text("cdef")) |
1576 | | - assert pred(Text("ghij", metadata=ElementMetadata(section="Appendix"))) |
1577 | | - |
1578 | | - |
1579 | 1516 | class Describe_is_on_next_page: |
1580 | 1517 | """Unit-test suite for `unstructured.chunking.base.is_on_next_page()` function. |
1581 | 1518 |
|
|
0 commit comments