Skip to content

[FIX] Ensure values as string. [Orange3-Text influenced] - #7351

Closed
krystofair wants to merge 1 commit into
biolab:masterfrom
krystofair:ensure-strings-values
Closed

krystofair wants to merge 1 commit into
biolab:masterfrom
krystofair:ensure-strings-values

Conversation

@krystofair

@krystofair krystofair commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Issue

I have got error from import_document when testing Orange3-Text:

ERROR: test_conllu_reader (tests.test_import_documents.TestImportDocuments.test_conllu_
reader)
(..more traceback..)
  File "(...)/.tox/orange-latest/lib/python3.11/site-packages/Orange/data/io_util.py", line 202, in <genexpr>
    for value in values if "." in value),
                           ^^^^^^^^^^^^
TypeError: argument of type 'float' is not iterable

Description of change

I unfortunatelly can't easily reproduce it from state of tests we have
currently.
After tracked it down. It can be checked, that when if branch where change is
executes, it in old behaviour return np.array of floats. And make
error in sanitize_variable.get_number_of_decimals, because of
quess_data_type returns values with wrong interface.
So the chain is:
import_documents.ImportDocument -> run -> _add_metadata ->
sanitize_variable(guess_data_type(data)).

Remarks
I don't have many experience with build np.array with dtype=str, AFAIK there are various of "<8u" types which are desired to "str" or just objecttype. So to don't make mismatch, I left it using vectorized function _as_string_array which is already used and have good result for sure.

EDIT: Check once again it, that was false.

I have got error from import_document when testing Orange3-Text:
```
ERROR: test_conllu_reader (tests.test_import_documents.TestImportDocuments.test_conllu_reader)
(..more traceback..)
  File "(...)/.tox/orange-latest/lib/python3.11/site-packages/Orange/data/io_util.py", line 202, in <genexpr>
    for value in values if "." in value),
                           ^^^^^^^^^^^^
TypeError: argument of type 'float' is not iterable
```

I unfortunatelly can't easily reproduce it from state of tests we have
currently. But it can be checked, that when `if` branch where change is
executes, it in old behaviour return `np.array` of `float`s. And make
error in `sanitize_variable.get_number_of_decimals`, because of
`quess_data_type` returns values with wrong interface.
So the chain is:
1. ImportDocument -> run -> _add_metadata ->
sanitize_variable(>guess_data_type(data)<).
@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.96%. Comparing base (66d8a10) to head (9c881bc).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7351      +/-   ##
==========================================
- Coverage   88.97%   88.96%   -0.01%     
==========================================
  Files         337      337              
  Lines       74648    74648              
==========================================
- Hits        66415    66414       -1     
- Misses       8233     8234       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@krystofair
krystofair marked this pull request as draft October 24, 2026 20:50
@krystofair krystofair closed this Oct 24, 2026
@krystofair
krystofair deleted the ensure-strings-values branch October 24, 2026 21:14
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.

1 participant