EandrewJones commented on code in PR #44:
URL: https://github.com/apache/flagon-distill/pull/44#discussion_r1677995240


##########
tests/test_transform.py:
##########
@@ -39,3 +49,32 @@ 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():
+    file = open(os.path.join(DATA_DIR, "sample_data.json"), "r")
+    logs = json.load(file)
+    def type_rule(log) -> bool:
+        return "type" in log and "scroll" in log["type"]
+    result = label_features(logs,[FeatureDefinition(rule=type_rule, 
label="scroll_type")])
+    assert isinstance(result, list)
+    assert "labels" in set().union(*result)
+    assert 'labels', 'scroll_type' in result[1].items()
+
+
+def test_feature_definition_does_not_accept_non_string_label():
+    with pytest.raises(TypeError):
+        file = open(os.path.join(DATA_DIR, "sample_data.json"), "r")
+        logs = json.load(file)
+        def input_rule(log):
+            return "target" in log and "input" in log["target"]
+        result = label_features(logs,[FeatureDefinition(rule=input_rule, 
label=10)])
+
+def test_feature_definition_does_not_accept_non_callable_rules():
+    with pytest.raises(TypeError):
+        #file = open(os.path.join(DATA_DIR, "sample_data.json"), "r")
+        #logs = json.load(file)

Review Comment:
   Please remove.



-- 
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

Reply via email to