massucattoj commented on code in PR #36983:
URL: https://github.com/apache/superset/pull/36983#discussion_r2672633356
##########
tests/unit_tests/utils/date_parser_tests.py:
##########
@@ -611,3 +611,48 @@ def test_date_range_migration() -> None:
field = "10 years ago"
assert not re.search(DateRangeMigration.x_dateunit, field)
+
+
+# Tests for bounded whitespace regex patterns in time_range_lookup
[email protected](
+ "time_range,should_parse",
+ [
+ ("last 7 days : ", True),
+ ("this week : ", True),
+ ("start of next month : ", True),
+ ("prior quarter : ", True),
+ ("last 7 days : ", True),
+ ("last 7 days : ", True),
+ ("last 7 days : ", True),
+ ("last 7 days : ", True),
+ ("last 7 days : ", False), # 6 spaces - exceeds bound
+ ("start of next month : ", True), # 5 spaces - valid
+ ("last week : ", True),
+ ("last week : ", True),
+ ("last week : ", True),
+ ("next 12 months : ", True),
+ ("next 12 months : ", True),
+ ("next 12 months : ", True),
+ ("last7days : ", False), # no space after scope - invalid
+ ("last 7days : ", True), # \s{0,5} allows 0 spaces after number -
valid
+ ("lastweek : ", False), # no space after scope - invalid
+ ("last" + " " * 100 + "7 days : ", False),
Review Comment:
It's outdated, already solve this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]