EandrewJones commented on code in PR #44: URL: https://github.com/apache/flagon-distill/pull/44#discussion_r1671014294
########## tests/test_transform.py: ########## @@ -14,7 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os + import distill +from tests import testing_utils +from tests.data_config import DATA_DIR +import pytest +from core import feature_definition Review Comment: This is breaking the tests. Need to import starting from module namespace, i.e. `from distill.core import feature_definition`. ########## examples/labels.py: ########## Review Comment: please remove all todo notes from this file. ########## tests/test_transform.py: ########## @@ -39,3 +45,26 @@ def test_pairwiseSeq_2(): test_list = [1, 2, 3, 4] result = distill.pairwiseSeq(test_list, split=True) assert result == ((1, 2, 3), (2, 3, 4)) + +def test_label_features_1(): + def input_rule(log): + return "target" in log and "input" in log["target"] + logs = testing_utils.setup("./data/task_example.json", "datetime") + result = distill.label_features(logs,[FeatureDefinition(rule=input_rule, label="input_target")]) + assert isinstance(result, list) + assert "input_target" in result Review Comment: Doesn't label features return a list of logs? If so, this will fail. As it's going to check whether a string is in the list of logs, but only dictionaries are in it. Instead, what you need to do is look at your input logs in `task_example.json`, figure out the indices of the logs that your FeatureDefintion will add the input_target label to, select those logs from the returned lists and validate that "input_target" has been added to the list stored in the "labels" field. -- 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: notifications-unsubscr...@flagon.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@flagon.apache.org For additional commands, e-mail: notifications-h...@flagon.apache.org