def test__extract_enclosing_text(val, quote): """Test extraction of enclosing quotes.""" enclosed_val = quote + val + quote enclosing_text, extracted_text = _extract_enclosing_text(enclosed_val) # Confirm the extracted text matches the original text assert (extracted_text == val) # Confirm the extracted enclosing text matches the original enclosing text assert (enclosing_text == quote)
def test__extract_enclosing_text_tail(raw_val, tail_text): """Test extraction of trailing text.""" val = raw_val + tail_text head, extracted_text, tail = _extract_enclosing_text(val) # Confirm the extracted text matches the original text assert extracted_text == raw_val # Confirm the trailing text matches the appended text assert tail == tail_text assert not head
def test__extract_enclosing_text_head(raw_val, head_text): """Test extraction of leading text.""" val = head_text + raw_val head, extracted_text, tail = _extract_enclosing_text(val) # Confirm the extracted text matches the original text assert extracted_text == raw_val # Confirm the leading text matches the prepended text assert head == head_text assert not tail