From 34356c9c7bdae03e83facc080d70e7b8b5cf4efe Mon Sep 17 00:00:00 2001 From: Spencer McIntyre Date: Sat, 8 Jul 2023 14:31:00 -0400 Subject: [PATCH] Change the behavior of STRING.to_ary --- docs/source/change_log.rst | 14 ++++++++++++++ lib/rule_engine/engine.py | 2 +- tests/ast/expression/attribute.py | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/source/change_log.rst b/docs/source/change_log.rst index fb7bd64..536d7d2 100644 --- a/docs/source/change_log.rst +++ b/docs/source/change_log.rst @@ -4,9 +4,23 @@ Change Log This document contains notes on the major changes for each version of the Rule Engine. In comparison to the git log, this list is curated by the development team for note worthy changes. +Version 4.x.x +------------- + +Version 4.0.0 +^^^^^^^^^^^^^ + +*In Progress* + +* **Breaking:** Changed ``STRING.to_ary`` to return an array of characters instead of splitting the string + * Use the new builtin ``$split`` function to split a string on whitespace into an array of words + Version 3.x.x ------------- +Version 3.6.0 +^^^^^^^^^^^^^ + Released :release:`3.6.0` on June 16th, 2023 * Removed testing for Python 3.4 and 3.5 on GitHub Actions diff --git a/lib/rule_engine/engine.py b/lib/rule_engine/engine.py index 0b5c5f4..981ba07 100644 --- a/lib/rule_engine/engine.py +++ b/lib/rule_engine/engine.py @@ -275,7 +275,7 @@ def string_as_upper(self, value): @attribute('to_ary', ast.DataType.STRING, result_type=ast.DataType.ARRAY(ast.DataType.STRING)) def string_to_ary(self, value): - return value.split() + return tuple(value) @attribute('to_flt', ast.DataType.STRING, result_type=ast.DataType.FLOAT) def string_to_flt(self, value): diff --git a/tests/ast/expression/attribute.py b/tests/ast/expression/attribute.py index 2b36d5d..8ec4696 100644 --- a/tests/ast/expression/attribute.py +++ b/tests/ast/expression/attribute.py @@ -181,7 +181,7 @@ def test_ast_expression_string_attributes(self): attributes = { 'as_lower': string.lower(), 'as_upper': string.upper(), - 'to_ary': tuple(string.split()), + 'to_ary': tuple(string), 'to_set': set(string), 'length': len(string), }