forked from alexey-goloburdin/telegram-finance-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_statisticformatter.py
68 lines (57 loc) · 2.46 KB
/
test_statisticformatter.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import pytest
from services.statistics.statisticformatter import StatisticFormatter
class TestStatisticFormatter:
def test_next_period_name_day(self):
answer = ("There's none any expense in this day \n\n"
"Week statistic: /week")
sf = StatisticFormatter('day')
sf.format_answer_sum_error()
assert sf.answer == answer
def test_next_period_name_week(self):
answer = ("There's none any expense in this week \n\n"
"Month statistic: /month")
sf = StatisticFormatter('week')
sf.format_answer_sum_error()
assert sf.answer == answer
def test_next_period_name_month(self):
answer = ("There's none any expense in this month \n\n"
"Year statistic: /year")
sf = StatisticFormatter('month')
sf.format_answer_sum_error()
assert sf.answer == answer
def test_next_period_name_year(self):
answer = ("There's none any expense in this year \n\n"
"Day statistic: /day")
sf = StatisticFormatter('year')
sf.format_answer_sum_error()
assert sf.answer == answer
def test_next_period_name_invalid_error(self):
with pytest.raises(AttributeError):
sf = StatisticFormatter('invalid')
sf.format_answer_sum_error()
def test_next_detail_period_name_day_error(self):
with pytest.raises(AttributeError):
sf = StatisticFormatter('day')
sf.format_answer_detail_error()
def test_next_detail_period_name_week(self):
answer = ("There's none such expense in this week \n\n"
"Month detail statistic: "
"/month_detail")
sf = StatisticFormatter('week')
sf.format_answer_detail_error()
assert sf.answer == answer
def test_next_detail_period_name_month(self):
answer = ("There's none such expense in this month \n\n"
"Week detail statistic: "
"/week_detail")
sf = StatisticFormatter('month')
sf.format_answer_detail_error()
assert sf.answer == answer
def test_next_detail_period_name_year_error(self):
with pytest.raises(AttributeError):
sf = StatisticFormatter('year')
sf.format_answer_detail_error()
def test_next_detail_period_name_invalid_error(self):
with pytest.raises(AttributeError):
sf = StatisticFormatter('invalid')
sf.format_answer_detail_error()