mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-19 15:53:07 +02:00
tests: Move current year and month determination into separate methods
This commit is contained in:
parent
e2ab941492
commit
f973efc093
1 changed files with 16 additions and 9 deletions
|
@ -5,6 +5,19 @@ from tasklib.task import local_zone
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
def current_year():
|
||||||
|
return local_zone.localize(datetime.now()).year
|
||||||
|
|
||||||
|
|
||||||
|
def current_month():
|
||||||
|
current_month_number = local_zone.localize(datetime.now()).month
|
||||||
|
months = ["January", "February", "March", "April",
|
||||||
|
"May", "June", "July", "August",
|
||||||
|
"September", "October", "November", "December"]
|
||||||
|
|
||||||
|
return months[current_month_number - 1]
|
||||||
|
|
||||||
|
|
||||||
class TestBurndownDailySimple(IntegrationTest):
|
class TestBurndownDailySimple(IntegrationTest):
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
|
@ -63,8 +76,7 @@ class TestGhistoryAnnualSimple(IntegrationTest):
|
||||||
for word in legend_words:
|
for word in legend_words:
|
||||||
assert re.search(word, output[-1], re.IGNORECASE)
|
assert re.search(word, output[-1], re.IGNORECASE)
|
||||||
|
|
||||||
current_year = local_zone.localize(datetime.now()).year
|
assert str(current_year()) in '\n'.join(output)
|
||||||
assert str(current_year) in '\n'.join(output)
|
|
||||||
|
|
||||||
|
|
||||||
class TestGhistoryMonthlySimple(IntegrationTest):
|
class TestGhistoryMonthlySimple(IntegrationTest):
|
||||||
|
@ -89,11 +101,6 @@ class TestGhistoryMonthlySimple(IntegrationTest):
|
||||||
for word in legend_words:
|
for word in legend_words:
|
||||||
assert re.search(word, output[-1], re.IGNORECASE)
|
assert re.search(word, output[-1], re.IGNORECASE)
|
||||||
|
|
||||||
current_year = local_zone.localize(datetime.now()).year
|
|
||||||
current_month_number = local_zone.localize(datetime.now()).month
|
|
||||||
months = ["January", "February", "March", "April",
|
|
||||||
"May", "June", "July", "August",
|
|
||||||
"September", "October", "November", "December"]
|
|
||||||
|
|
||||||
assert str(current_year) in '\n'.join(output)
|
assert str(current_year()) in '\n'.join(output)
|
||||||
assert str(months[current_month_number - 1]) in '\n'.join(output)
|
assert current_month() in '\n'.join(output)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue