Skip to content

Commit

Permalink
fix: add missing tests (#3004)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbp committed Jul 23, 2021
1 parent 64591c9 commit a7e5384
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/unit/types/arrays/test_search_ops.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
import numpy as np
import re

from jina import Document, DocumentArray
from jina.types.arrays.memmap import DocumentArrayMemmap
Expand All @@ -25,9 +25,9 @@ def docarray_memmap_type(list_doc_examples, tmpdir):
return doc_array_memmap


@pytest.mark.parametrize('regexes', [{'city': r'B.*'}, {'city': re.compile('B.*')}])
@pytest.mark.parametrize('doc_array_creator', [docarray_type, docarray_memmap_type])
def test_single_regex(doc_array_creator, list_doc_examples, tmpdir):
regexes = {'city': r'B.*'}
def test_single_regex(regexes, doc_array_creator, list_doc_examples, tmpdir):
doc_array = doc_array_creator(list_doc_examples, tmpdir)
filtered_doc_array = doc_array.find(regexes=regexes)

Expand All @@ -38,9 +38,15 @@ def test_single_regex(doc_array_creator, list_doc_examples, tmpdir):
assert d.tags['city'].startswith('B')


@pytest.mark.parametrize(
'regexes',
[
{'city': r'B.*', 'phone': 'Non'},
{'city': re.compile('B.*'), 'phone': re.compile('Non')},
],
)
@pytest.mark.parametrize('doc_array_creator', [docarray_type, docarray_memmap_type])
def test_multiple_regex(doc_array_creator, list_doc_examples, tmpdir):
regexes = {'city': r'B.*', 'phone': 'Non'}
def test_multiple_regex(regexes, doc_array_creator, list_doc_examples, tmpdir):
doc_array = doc_array_creator(list_doc_examples, tmpdir)

filtered_doc_array = doc_array.find(
Expand Down

0 comments on commit a7e5384

Please sign in to comment.