-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_reader.py
54 lines (34 loc) · 1.43 KB
/
test_reader.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
47
48
49
50
51
52
53
54
from reader import ReaderTool, page_result
def test_page_result():
s = "Hello world"
assert page_result(s, 0, 5) == "Hello"
assert page_result(s, 4, 1) == "o"
assert page_result(s, 10, 5) == "d"
def test_reader_blog_article():
tool = ReaderTool()
url = "https://www.taivo.ai/startup-stock-options/"
result = tool.run({"url": url})
expected_start = "TITLE: Startup stock options: a beginner's guide"
assert result.strip().startswith(expected_start)
assert (
"TOP_IMAGE_URL: https://www.taivo.ai/content/images/2022/01/stonks.jpg"
in result
)
assert "assume the option package is worth nothing" in result
def test_cursor():
tool = ReaderTool()
url = "https://www.taivo.ai/startup-stock-options/"
result = tool.run({"url": url, "cursor": 10000})
assert "you buy stock in a publicly-traded company" not in result
def test_reader_blog_article_no_body():
tool = ReaderTool()
url = "https://www.taivo.ai/startup-stock-options/"
result = tool.run({"url": url, "include_body": False})
expected_start = "TITLE: Startup stock options: a beginner's guide"
assert result.strip().startswith(expected_start)
assert "assume the option package is worth nothing" not in result
def test_google_com():
tool = ReaderTool()
url = "https://www.google.com"
result = tool.run({"url": url, "include_body": False})
assert "TITLE: Google" in result