Add representation invariants to processing.py

This commit is contained in:
MstrPikachu
2021-12-13 03:15:11 -05:00
parent c471dbf19e
commit 79f890b28c
+8
View File
@@ -103,6 +103,10 @@ def get_user_popularity_ranking(user: str) -> int:
class UserSample: class UserSample:
""" """
This is a data class storing our different samples. This is a data class storing our different samples.
Representation Invariants:
- all(news != '' for news in self.english_news)
""" """
most_popular: list[ProcessedUser] most_popular: list[ProcessedUser]
random: list[ProcessedUser] random: list[ProcessedUser]
@@ -219,6 +223,10 @@ class Posting(NamedTuple):
""" """
Posting data stores the processed tweets data, and it contains info such as whether or not a Posting data stores the processed tweets data, and it contains info such as whether or not a
tweet is covid-related tweet is covid-related
Representation Invariants:
- popularity >= 0
""" """
# Full text of the post's content # Full text of the post's content
covid_related: bool covid_related: bool