Linted tests
Browse files- tests/test_plotly.py +6 -10
tests/test_plotly.py
CHANGED
@@ -6,21 +6,17 @@ class TestPlotlyClient:
|
|
6 |
self.postly_instance = PostlyClient()
|
7 |
|
8 |
# define reference data for testing
|
9 |
-
self.gt_posts = [
|
10 |
-
"just #chilling today",
|
11 |
-
"eating #steak for dinner",
|
12 |
-
"ugh! this #steak tasted like dog food"
|
13 |
-
]
|
14 |
self.gt_topics = [["chilling"], ["steak"], ["steak"]]
|
15 |
|
16 |
# add toy data for testing
|
17 |
self.postly_instance.add_user("john")
|
18 |
for post in self.gt_posts:
|
19 |
self.postly_instance.add_post("john", post)
|
20 |
-
|
21 |
def test_add_user(self):
|
22 |
assert "john" in self.postly_instance.userPosts
|
23 |
-
|
24 |
def test_add_post(self):
|
25 |
assert len(self.postly_instance.userPosts["john"]) == 3
|
26 |
|
@@ -37,10 +33,10 @@ class TestPlotlyClient:
|
|
37 |
assert len(retrieved_posts) == 2
|
38 |
for post in retrieved_posts:
|
39 |
assert "#steak" in post
|
40 |
-
|
41 |
def test_get_trending_topics(self):
|
42 |
trending_topics = self.postly_instance.get_trending_topics(1, 3)
|
43 |
-
|
44 |
assert len(trending_topics) == 2
|
45 |
assert trending_topics == ["steak", "chilling"]
|
46 |
|
@@ -55,7 +51,7 @@ class TestPlotlyClient:
|
|
55 |
temporary_postly_instance.add_post("simon", "just #coding today")
|
56 |
|
57 |
assert "simon" in temporary_postly_instance.userPosts
|
58 |
-
|
59 |
temporary_postly_instance.delete_user("simon")
|
60 |
|
61 |
assert "simon" not in temporary_postly_instance.userPosts
|
|
|
6 |
self.postly_instance = PostlyClient()
|
7 |
|
8 |
# define reference data for testing
|
9 |
+
self.gt_posts = ["just #chilling today", "eating #steak for dinner", "ugh! this #steak tasted like dog food"]
|
|
|
|
|
|
|
|
|
10 |
self.gt_topics = [["chilling"], ["steak"], ["steak"]]
|
11 |
|
12 |
# add toy data for testing
|
13 |
self.postly_instance.add_user("john")
|
14 |
for post in self.gt_posts:
|
15 |
self.postly_instance.add_post("john", post)
|
16 |
+
|
17 |
def test_add_user(self):
|
18 |
assert "john" in self.postly_instance.userPosts
|
19 |
+
|
20 |
def test_add_post(self):
|
21 |
assert len(self.postly_instance.userPosts["john"]) == 3
|
22 |
|
|
|
33 |
assert len(retrieved_posts) == 2
|
34 |
for post in retrieved_posts:
|
35 |
assert "#steak" in post
|
36 |
+
|
37 |
def test_get_trending_topics(self):
|
38 |
trending_topics = self.postly_instance.get_trending_topics(1, 3)
|
39 |
+
|
40 |
assert len(trending_topics) == 2
|
41 |
assert trending_topics == ["steak", "chilling"]
|
42 |
|
|
|
51 |
temporary_postly_instance.add_post("simon", "just #coding today")
|
52 |
|
53 |
assert "simon" in temporary_postly_instance.userPosts
|
54 |
+
|
55 |
temporary_postly_instance.delete_user("simon")
|
56 |
|
57 |
assert "simon" not in temporary_postly_instance.userPosts
|