run make format to elasticsearch.tests.*

This commit is contained in:
Alejandro Nunez Capote 2019-06-10 13:19:01 -04:00
parent 4b0ca35e2c
commit 53e13559c4
2 changed files with 54 additions and 25 deletions

View File

@ -28,7 +28,9 @@ def test_filter_string():
filter_generation(
"articlesAsField",
'headline: "A text"',
lambda mock: mock.assert_called_with(Bool(must=[Match(headline={"query": "A text", "fuzziness": "auto"})])),
lambda mock: mock.assert_called_with(
Bool(must=[Match(headline={"query": "A text", "fuzziness": "auto"})])
),
)
@ -36,7 +38,9 @@ def test_filter_string_date():
filter_generation(
"articlesAsField",
'headline: "A text"',
lambda mock: mock.assert_called_with(Bool(must=[Match(headline={"query": "A text", "fuzziness": "auto"})])),
lambda mock: mock.assert_called_with(
Bool(must=[Match(headline={"query": "A text", "fuzziness": "auto"})])
),
)
@ -62,7 +66,9 @@ def test_filter_in_meta():
filter_generation(
"articlesInMeta",
'headline: "A text"',
lambda mock: mock.assert_called_with(Bool(must=[Match(headline={"query": "A text", "fuzziness": "auto"})])),
lambda mock: mock.assert_called_with(
Bool(must=[Match(headline={"query": "A text", "fuzziness": "auto"})])
),
)
@ -70,7 +76,9 @@ def test_filter_in_meta_dict():
filter_generation(
"articlesInMetaDict",
'headline: "A text"',
lambda mock: mock.assert_called_with(Bool(must=[Match(headline={"query": "A text", "fuzziness": "auto"})])),
lambda mock: mock.assert_called_with(
Bool(must=[Match(headline={"query": "A text", "fuzziness": "auto"})])
),
)
@ -78,7 +86,9 @@ def test_filter_in_meta_dict_foreign():
filter_generation(
"articlesInMetaDict",
'reporterEmail: "A mail"',
lambda mock: mock.assert_called_with(Bool(must=[Match(reporter__email={"query": "A mail", "fuzziness": "auto"})])),
lambda mock: mock.assert_called_with(
Bool(must=[Match(reporter__email={"query": "A mail", "fuzziness": "auto"})])
),
)
@ -86,16 +96,18 @@ def test_filter_in_multi_field():
filter_generation(
"articlesInMultiField",
'contain: "A text"',
lambda mock: mock.assert_called_with(Bool(
must=[
Bool(
should=[
Match(headline={"query": "A text", "fuzziness": "auto"}),
Match(lang={"query": "A text", "fuzziness": "auto"}),
]
)
]
)),
lambda mock: mock.assert_called_with(
Bool(
must=[
Bool(
should=[
Match(headline={"query": "A text", "fuzziness": "auto"}),
Match(lang={"query": "A text", "fuzziness": "auto"}),
]
)
]
)
),
)
@ -107,10 +119,15 @@ def compare_must_array(must, other_must):
def test_filter_generating_all():
spected_query = Bool(must=[Match(headline={"query": "A text", "fuzziness": "auto"}),
Match(pub_date={"query": "0000-00-00", "fuzziness": "auto"}),
Match(pub_date_time={"query": "00:00:00", "fuzziness": "auto"}),
Match(lang={"query": "es", "fuzziness": "auto"}), Term(importance=1), ])
spected_query = Bool(
must=[
Match(headline={"query": "A text", "fuzziness": "auto"}),
Match(pub_date={"query": "0000-00-00", "fuzziness": "auto"}),
Match(pub_date_time={"query": "00:00:00", "fuzziness": "auto"}),
Match(lang={"query": "es", "fuzziness": "auto"}),
Term(importance=1),
]
)
filter_generation(
"articlesInGenerateAll",

View File

@ -48,7 +48,9 @@ def test_processor_phrase():
filter_generation(
"articlesInMetaDict",
'headlinePhrase: "A text"',
lambda mock: mock.assert_called_with(Bool(must=[MatchPhrase(headline={"query": "A text"})])),
lambda mock: mock.assert_called_with(
Bool(must=[MatchPhrase(headline={"query": "A text"})])
),
)
@ -56,7 +58,9 @@ def test_processor_prefix():
filter_generation(
"articlesInMetaDict",
'headlinePrefix: "A text"',
lambda mock: mock.assert_called_with(Bool(must=[MatchPhrasePrefix(headline={"query": "A text"})])),
lambda mock: mock.assert_called_with(
Bool(must=[MatchPhrasePrefix(headline={"query": "A text"})])
),
)
@ -64,7 +68,9 @@ def test_processor_in():
filter_generation(
"articlesInMetaDict",
'headlineIn: ["A text 1", "A text 2"]',
lambda mock: mock.assert_called_with(Bool(must=[Terms(headline=["A text 1", "A text 2"])])),
lambda mock: mock.assert_called_with(
Bool(must=[Terms(headline=["A text 1", "A text 2"])])
),
)
@ -72,7 +78,9 @@ def test_processor_exits():
filter_generation(
"articlesInMetaDict",
"headlineExits: true",
lambda mock: mock.assert_called_with(Bool(must=[Bool(must=[Exists(field="headline")])])),
lambda mock: mock.assert_called_with(
Bool(must=[Bool(must=[Exists(field="headline")])])
),
)
@ -80,7 +88,9 @@ def test_processor_lte():
filter_generation(
"articlesInMetaDict",
'headlineLte: "A text"',
lambda mock: mock.assert_called_with(Bool(must=Range(headline={"lte": "A text"}))),
lambda mock: mock.assert_called_with(
Bool(must=Range(headline={"lte": "A text"}))
),
)
@ -88,5 +98,7 @@ def test_processor_gte():
filter_generation(
"articlesInMetaDict",
'headlineGte: "A text"',
lambda mock: mock.assert_called_with(Bool(must=Range(headline={"gte": "A text"}))),
lambda mock: mock.assert_called_with(
Bool(must=Range(headline={"gte": "A text"}))
),
)