Skip to content

Commit 682686f

Browse files
committed
Document the defensive code and deprecation
1 parent dfc86f1 commit 682686f

2 files changed

Lines changed: 8 additions & 28 deletions

File tree

terminusdb_client/tests/test_woql_subquery_aggregation.py

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -317,36 +317,12 @@ def test_aggregation_with_distinct(self):
317317
assert result is query
318318
assert query._query.get("@type") == "Count"
319319

320-
# @pytest.mark.skip(reason="""BLOCKED: Lines 852-853 in woql_query.py - edge case not covered
321-
322-
# PROBLEM: Lines 852-853 handle initialization of the "and" array when woql_and()
323-
# is called on a query that already has @type="And" but no "and" key yet.
324-
325-
# This is an edge case that occurs when:
326-
# 1. A query's cursor is manually set to {"@type": "And"} without an "and" array
327-
# 2. Then woql_and() is called to add queries
328-
329-
# The code checks: if "and" not in self._cursor:
330-
# Then initializes: self._cursor["and"] = []
331-
332-
# This edge case is difficult to trigger through normal API usage because:
333-
# - woql_and() always sets both @type and initializes the "and" array
334-
# - The only way to get @type="And" without "and" is through manual manipulation
335-
336-
# RECOMMENDATION: This is defensive programming for an edge case that shouldn't
337-
# occur in normal usage. Consider either:
338-
# 1. Remove this check if it's truly unreachable through the public API
339-
# 2. Add internal validation to prevent this state
340-
# 3. Document this as defensive code and accept the uncovered lines
341-
# """)
342320
def test_woql_and_with_uninitialized_and_array(self):
343-
"""Test woql_and() when cursor has @type='And' but no 'and' array.
344-
345-
This tests lines 852-853 which defensively initialize the "and" array
346-
if it doesn't exist. This edge case occurs when the cursor is manually
347-
manipulated to have @type="And" without the corresponding "and" array.
321+
"""Test woql_and() defensive programming for uninitialized 'and' array.
348322
349-
This is a TDD test showing the CORRECT expected behavior for this edge case.
323+
Tests that woql_and() properly handles the edge case where cursor has
324+
@type='And' but no 'and' array (e.g., from manual cursor manipulation).
325+
The defensive code should initialize the missing array.
350326
"""
351327
query = WOQLQuery()
352328

terminusdb_client/woqlquery/woql_query.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,10 @@ def _vlist(self, target_list):
350350
return vl
351351

352352
def _data_value_list(self, target_list):
353+
"""DEPRECATED: Dead code - never called anywhere in the codebase.
354+
355+
Use _value_list() instead. This method will be removed in a future release.
356+
"""
353357
dvl = []
354358
for item in target_list:
355359
o = self._clean_data_value(item)

0 commit comments

Comments
 (0)