From 1a9ce6ee3e62a9694ac74e14d7c295742cfa9fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cervenka?= Date: Fri, 20 May 2022 14:59:53 +0200 Subject: [PATCH] allow pipe character in dimension values --- setup.cfg | 2 +- src/epstats/toolkit/parser.py | 2 +- tests/epstats/toolkit/test_parser.py | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index b0cbe21..1f183a8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = ep-stats -version = 1.2.0 +version = 1.2.1 description = Statistical package to evaluate ab tests in experimentation platform. long_description = file: README.md long_description_content_type = text/markdown diff --git a/src/epstats/toolkit/parser.py b/src/epstats/toolkit/parser.py index 6f16483..0f89f5f 100644 --- a/src/epstats/toolkit/parser.py +++ b/src/epstats/toolkit/parser.py @@ -27,7 +27,7 @@ def __init__(self, nominator: str, denominator: str): goal = Word(alphas + "_" + nums).setParseAction(Goal) number = Word(nums).setParseAction(Number) dimension = Word(alphas + "_").setParseAction(Dimension) - dimension_value = Word(alphanums + "_" + "-" + "." + "%" + " " + "/").setParseAction(DimensionValue) + dimension_value = Word(alphanums + "_" + "-" + "." + "%" + " " + "/" + "|").setParseAction(DimensionValue) dimension_list = delimitedList(dimension + "=" + dimension_value) ep_goal = (func + "(" + unit_type + "." + agg_type + "." + goal + ")").setParseAction(EpGoal) diff --git a/tests/epstats/toolkit/test_parser.py b/tests/epstats/toolkit/test_parser.py index 6e3760b..6928ef6 100644 --- a/tests/epstats/toolkit/test_parser.py +++ b/tests/epstats/toolkit/test_parser.py @@ -271,6 +271,16 @@ def test_raise_if_duplicate_dimensions(): "test_unit_type.unit.conversion": {"x": "", "y": ""}, }, ), + ( + Parser( + "count(test_unit_type.global.conversion(x=A/ A|BB, y=X|Y|Z))", + "count(test_unit_type.unit.conversion)", + ), + { + "test_unit_type.global.conversion[x=A/ A|BB, y=X|Y|Z]": {"x": "A/ A|BB", "y": "X|Y|Z"}, + "test_unit_type.unit.conversion": {"x": "", "y": ""}, + }, + ), ], ) def test_get_goals_dimensional(parser, expected_goals):