All datetime funcs cleared

This commit is contained in:
Andrey Z 2021-04-10 14:54:15 +03:00
parent 4ab98688c9
commit 63ff322215
2 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,7 @@ from datetime64_extended_range.common import *
# https://github.com/ClickHouse/ClickHouse/issues/22928 : toStartOf...() wrong when out of normal range
# https://github.com/ClickHouse/ClickHouse/issues/22929 : toUnixTimestamp() exception when out of normal
# https://github.com/ClickHouse/ClickHouse/issues/22930 : toWeek()
# https://github.com/ClickHouse/ClickHouse/issues/22948 : toYearWeek()
xfails = {
"type conversion/to int 8 16 32 64 128 256/:": [(Fail, "https://github.com/ClickHouse/ClickHouse/issues/16581#issuecomment-804360350")],
@ -34,6 +35,7 @@ xfails = {
"date time funcs/to start of :/:": [(Fail, "https://github.com/ClickHouse/ClickHouse/issues/22928")],
"date time funcs/to unix timestamp/:": [(Fail, "https://github.com/ClickHouse/ClickHouse/issues/22929")],
"date time funcs/to week/:": [(Fail, "https://github.com/ClickHouse/ClickHouse/issues/22930")],
"date time funcs/to year week/:": [(Fail, "https://github.com/ClickHouse/ClickHouse/issues/22948")],
}

View File

@ -119,11 +119,13 @@ def to_day_of(self, py_func, ch_func):
with When("I check each of the datetimes"):
for dt in datetimes:
for tz1, tz2 in itertools.product(timezones, timezones):
with Example(f"{dt} {tz1} -> {tz2}"):
with When(f"{dt} {tz1} -> {tz2}"):
with By("Computing expected result using pytz"):
time_tz1 = pytz.timezone(tz1).localize(dt)
time_tz2 = time_tz1.astimezone(pytz.timezone(tz2))
result = eval(f"time_tz2.timetuple().{py_func}")
if py_func == "tm_wday":
result += 1
expected = f"{result}"
with And(f"Forming a {ch_func} ClickHouse query"):
dt_str = dt.strftime("%Y-%m-%d %H:%M:%S")