From 051e790beae6c7bfaaf65a7f5b581cd873c04e54 Mon Sep 17 00:00:00 2001 From: Caleb Hattingh Date: Sun, 18 Feb 2024 03:13:08 +0100 Subject: [PATCH] hide test imports for non-lindera test run --- tests/test_lindera.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/test_lindera.py b/tests/test_lindera.py index 720791e7..132b2bc4 100644 --- a/tests/test_lindera.py +++ b/tests/test_lindera.py @@ -1,15 +1,23 @@ import pytest pytestmark = pytest.mark.lindera -from tantivy import SchemaBuilder, Index, Document, lindera +from tantivy import SchemaBuilder, Index, Document @pytest.mark.parametrize("mode", [ - lindera.LNormal(), - lindera.LDecompose(), + "normal", + "decompose", ]) def test_basic(mode): - # breakpoint() + # The import is here so that the non-lindera tests + # can run without lindera installed. + from tantivy import lindera + + if mode == "normal": + mode = lindera.LNormal() + else: + mode = lindera.LDecompose() + sb = SchemaBuilder() sb.add_text_field("title", stored=True, tokenizer_name="lang_ja") schema = sb.build()