Skip to content

Conversation

@hoijnet
Copy link
Collaborator

@hoijnet hoijnet commented Jan 9, 2026

This PR improves test coverage for terminusdb_client/woqlquery/woql_query.py, increasing coverage from 85% to 94% (+9 percentage points).

Before (main branch):

  • Overall coverage*: 85% (7303/8598 lines)
  • Total tests: 591
  • All the test files were also part of coverage measurement

After:

  • Overall coverage*: 95% (13294/14036 lines)
  • Total tests: 1356 (+765 tests)
  • Test files no longer part of coverage measurement

Test Files Created (19 new files, 765 new tests)

Core Test Files

  1. test_woql_core.py - Core WOQL query functionality tests
  2. test_woql_query_overall.py - Overall query integration tests
  3. test_woql_query_edge_cases.py - General query edge cases
  4. test_woql_test_helpers.py - Test helper utilities and fixtures

Edge Case & Advanced Tests

  1. test_woql_edge_cases_extended.py - Vocabulary, select, as(), cursor, arithmetic, Doc/Vars
  2. test_woql_advanced_features.py - Advanced filtering, aggregation, subqueries, recursive queries, complex patterns
  3. test_woql_remaining_edge_cases.py - Args introspection for 30+ methods, distinct, as() edge cases

Operation-Specific Tests

  1. test_woql_set_operations.py - Concat, join, sum, slice, set operations (member, difference, intersection, union)
  2. test_woql_graph_operations.py - Graph modification, queries, traversal, analytics, context, updates, metadata
  3. test_woql_path_operations.py - Path operations, triple/quad operations, added/removed triples
  4. test_woql_json_operations.py - JSON serialization, document handling, type conversions
  5. test_woql_subquery_aggregation.py - Subquery execution, aggregation functions, group by, having clauses

Builder & Utility Tests

  1. test_woql_query_builder.py - Query builder methods, internal functions, contains_update checks
  2. test_woql_cursor_management.py - Cursor positioning, movement, state management, data value cleaning
  3. test_woql_utility_methods.py - Find last subject, same entry comparison, string matching, triple builder context
  4. test_woql_utility_functions.py - Set operations, list operations, arithmetic, comparison, string, regex, document operations

Type System & Validation Tests

  1. test_woql_type_system.py - Type conversion, inference, custom types, validation, data types, coercion
  2. test_woql_type.py - Type handling and type-related operations
  3. test_woql_schema_validation.py - Schema validation, type checking, vocabulary loading, cursor wrapping, select/distinct validation

Bug Fixes

  1. woql_query.py line 355 - Fixed _data_value_list bug (incorrect method call: clean_data_value_clean_data_value)
  2. woql_query.py lines 852-857 - Added defensive programming for And array initialization to prevent edge case failures
  3. test_woql_path_operations.py line 9 - Fixed pytest.skip syntax error
  4. test_woql_query_builder.py lines 195-212 - Updated deprecated test implementation

Discovery on select() Design Change

The select() predicate should likely take no arguments too as a valid case across both python and javascript client. The documentation is now updated.

Comparison with JavaScript Client

When unsure, verified against the JavaScript client (terminusdb-client-js) to ensure consistency:

  • Args introspection feature matches JS client behavior (also disabled in JS for quad operations, "args" would not be possible as a value with the args discovery and introspection/reflection is a better way to achieve the goal)
  • Method signatures and return values align with JS equivalents
  • Error handling patterns consistent across both clients

Documentation Created

  • docs/KNOWN_ISSUES_AND_UNCOVERED_CODE.md - Comprehensive catalog of remaining issues, bugs, and uncovered code organized by severity and category

Next Steps

To improve coverage and quality:

  1. Address known issues documented in docs/KNOWN_ISSUES_AND_UNCOVERED_CODE.md
  2. Add tests for schema/builder operations
  3. Consider removing deprecated _data_value_list() method after deprecation period
  4. Consider deprecating and removing the "args" first argument introspection feature

@hoijnet hoijnet linked an issue Jan 9, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Increase test coverage

2 participants