forked from alex000kim/slack-gpt-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_utils.py
50 lines (33 loc) · 2.32 KB
/
test_utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import pytest
from utils import (extract_url_list)
def test_extract_url_list_simple_link():
text = "<@U05AHRCAXTL> can you summarize this <https://en.wikipedia.org/wiki/Doom_book>"
url_list = extract_url_list(text)
assert url_list != None
assert len(url_list) == 1
# def test_extract_url_list_hyperlink():
# '''
# FAILURE: this parser is not able to see the link within a slack-style syntax
# '''
# text = "<@U05AHRCAXTL> can you summarize this <https://en.wikipedia.org/wiki/Doom_book|wikipedia page>"
# url_list = extract_url_list(text)
# assert url_list != None
# assert len(url_list) == 1
def test_extract_url_list_pdf_link():
text = "<@U05AHRCAXTL> are you able to access this <https://hartfordhealthcare.org/file%20library/chna/chna-hartford-hospital-2022.pdf?_ga=2.248866113.710713768.1687980028-1118602651.1687980028&_gl=1*depsgg*_ga*MTExODYwMjY1MS4xNjg3OTgwMDI4*_ga_4604MZZMMD*MTY4Nzk4MDAyOC4xLjAuMTY4Nzk4MDA0My40NS4wLjA>."
url_list = extract_url_list(text)
assert url_list != None
assert len(url_list) == 1
def test_extract_url_list_pdf_hyperlink():
text = "<@U05AHRCAXTL> are you able to access this <https://hartfordhealthcare.org/file%20library/chna/chna-hartford-hospital-2022.pdf?_ga=2.248866113.710713768.1687980028-1118602651.1687980028&_gl=1*depsgg*_ga*MTExODYwMjY1MS4xNjg3OTgwMDI4*_ga_4604MZZMMD*MTY4Nzk4MDAyOC4xLjAuMTY4Nzk4MDA0My40NS4wLjA.|2022 Community Health Needs Assessment>"
url_list = extract_url_list(text)
assert url_list != None
assert len(url_list) == 1
# def test_extract_url_list():
# '''
# the extract_url_list function does not return when given this text
# '''
# text = "<@U05AHRCAXTL> please identify opportunities that a patient engagement software company, specifically, <https://cipherhealth.com/|CipherHealth> has to support Hartford Healthcare, based on their <https://hartfordhealthcare.org/file%20library/chna/chna-hartford-hospital-2022.pdf?_ga=2.248866113.710713768.1687980028-1118602651.1687980028&_gl=1*depsgg*_ga*MTExODYwMjY1MS4xNjg3OTgwMDI4*_ga_4604MZZMMD*MTY4Nzk4MDAyOC4xLjAuMTY4Nzk4MDA0My40NS4wLjA.|2022 Community Health Needs Assessment> which outlines their plans to improve the lives of their community."
# url_list = extract_url_list(text)
# #NEVER RETURNS
# assert url_list == None