fix: adding an int() cast to avoid IndexError#394
Conversation
Codecov Report
@@ Coverage Diff @@
## main #394 +/- ##
==========================================
+ Coverage 84.77% 86.53% +1.76%
==========================================
Files 134 134
Lines 6358 6388 +30
==========================================
+ Hits 5390 5528 +138
+ Misses 968 860 -108
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
alaeddine-13
left a comment
There was a problem hiding this comment.
can you also add a test that shows the issue ?
|
@lhr0909 I created a mvp example to reproduce your issue outside of Jina Flow: Hope this can help you to add a unitest to cover this issue |
| 'attribute_type' | ||
| ] | ||
| position = self._metadata['multi_modal_schema'][attribute].get('position') | ||
| position = int(self._metadata['multi_modal_schema'][attribute].get('position')) |
There was a problem hiding this comment.
@alaeddine-13 Yeah I tried this, and this breaks tests which don't generate position attribute. So that's why I cast to int inside the branch.
Yeah about this.. This is a use case built by me, so I know there are other docarray bugs so I have to use other ways to traverse 🤣 . Was gonna raise another bug when my project finishes so.. I don't think I will have time adding unit tests to this, so if the team like @alaeddine-13 can help that'd be great. Cheers. |
Goals:
to resolve #393