Skip to content

Commit bc5c32d

Browse files
committed
use locale en_US & other cleanup
1 parent c3e8700 commit bc5c32d

File tree

8 files changed

+17
-245
lines changed

8 files changed

+17
-245
lines changed

.dockerignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,8 @@ dmypy.json
4848

4949
# docker bits
5050
Dockerfile*
51-
docker-compose*
51+
docker-compose*
52+
53+
# Temp files
54+
tmp/
55+

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased
9+
10+
### Changed
11+
- Use locale en_US instead of c.utf-8
12+
13+
### Removed
14+
- Generic fulltext search and tests
15+
816
## [0.0.19] - 2022-04-15
917
### Added
1018
- github actions to build `develop`, `pr-x` and released version (e.g. `1.2.3`) Tags

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ shell:
1313
docker-compose run re_api sh
1414

1515
reset:
16-
docker-compose --rmi all -v
17-
docker-compose build
16+
docker-compose down --rmi all -v
1817

1918
full_query_testing:
2019
DO_QUERY_TESTING=full time python -m pytest -s $(QUERY_TESTING_FILE)

client_src/test/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
from uuid import uuid4
44

5-
from relation_engine_client import REClient
5+
from relation_engine_client.main import REClient
66
from relation_engine_client.exceptions import RERequestError, RENotFound
77

88
_API_URL = os.environ.get("RE_API_URL", "http://localhost:5000")

relation_engine_server/utils/json_validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def resolve_remote(self, uri):
159159

160160
if scheme in self.handlers:
161161
result = self.handlers[scheme](uri)
162-
elif scheme in [u"http", u"https"]:
162+
elif scheme in ["http", "https"]:
163163
# Requests has support for detecting the correct encoding of
164164
# json over http
165165
result = requests.get(uri).json()

spec/analyzers/icu_tokenize.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "icu_tokenize",
33
"type": "text",
44
"properties": {
5-
"locale": "c.utf-8",
5+
"locale": "en_US",
66
"accent": false,
77
"case": "lower",
88
"stemming": false,

spec/stored_queries/generic/fulltext_search.yaml

Lines changed: 0 additions & 94 deletions
This file was deleted.

spec/test/stored_queries/test_fulltext_search.py

Lines changed: 0 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
"""
22
Tests for stored queries involving a fulltext search:
3-
* Generic fulltext_search (should be used with caution because it can be slow and timeout at 60s)
43
* Taxonomy taxonomy_search_species_strain
54
* Taxonomy taxonomy_search_species_strain_no_sort
65
76
The latter two are switched between depending on the length of the search text.
8-
These stored query tests are all bundled in one test file because their original purpose is to do a species/strain
9-
name search on the ncbi_taxon collection
107
118
These tests run within the re_api docker image, and require access to the ArangoDB, auth, and workspace images.
129
"""
@@ -251,148 +248,6 @@ def test_prefix_hit(self):
251248
)
252249

253250

254-
class TestFulltextSearchStoredQuery(unittest.TestCase):
255-
@classmethod
256-
def setUpClass(cls):
257-
check_spec_test_env()
258-
create_test_docs("ncbi_taxon", ncbi_taxa)
259-
260-
def test_ncbi_taxon_scinames(self):
261-
"""Happy path"""
262-
for sciname in scinames_test_all:
263-
_fulltext_search_query(
264-
self,
265-
coll="ncbi_taxon",
266-
search_attrkey="scientific_name",
267-
search_text=sciname,
268-
ts=_NOW if sciname in scinames_test_latest else None,
269-
filter_attr_expr=[
270-
{"rank": "species"},
271-
{"rank": "strain"},
272-
{"strain": True},
273-
],
274-
offset=None,
275-
limit=LIMIT,
276-
select="scientific_name",
277-
# ---
278-
expect_error=False,
279-
expect_hit=True,
280-
)
281-
282-
def test_null_bind_params(self):
283-
"""Leave off parameters"""
284-
for sciname in scinames_test_all:
285-
_fulltext_search_query(
286-
self,
287-
coll="ncbi_taxon",
288-
search_attrkey="scientific_name",
289-
search_text=sciname,
290-
ts=None,
291-
filter_attr_expr=None,
292-
offset=None,
293-
limit=None,
294-
select=None,
295-
# ---
296-
expect_error=False,
297-
expect_hit=True,
298-
)
299-
300-
def test_fully_specified_bind_params(self):
301-
"""Specify all parameters"""
302-
for sciname in scinames_test_all:
303-
_fulltext_search_query(
304-
self,
305-
coll="ncbi_taxon",
306-
search_attrkey="scientific_name",
307-
search_text=sciname,
308-
ts=_NOW if sciname in scinames_test_latest else None,
309-
filter_attr_expr=[
310-
{"rank": "species"},
311-
{"rank": "strain"},
312-
{"strain": True},
313-
],
314-
offset=0,
315-
limit=LIMIT,
316-
select=["id", "scientific_name"],
317-
# ---
318-
expect_error=False,
319-
expect_hit=True,
320-
)
321-
322-
def test_extra_params(self):
323-
"""Extra params not in spec/aql"""
324-
_fulltext_search_query(
325-
self,
326-
coll="ncbi_taxon",
327-
search_attrkey="scientific_name",
328-
search_text="esch",
329-
ts=None,
330-
filter_attr_expr=[
331-
{"rank": "species"},
332-
{"rank": "strain"},
333-
{"strain": True},
334-
],
335-
offset=0,
336-
limit=LIMIT,
337-
select=["id", "scientific_name"],
338-
extra_unused_param=42,
339-
# ---
340-
expect_error=("Additional properties are not allowed"),
341-
)
342-
343-
def test_validation_fail(self):
344-
_fulltext_search_query(
345-
self,
346-
coll=[],
347-
search_attrkey=42,
348-
search_text={"hi": 1},
349-
ts=None,
350-
filter_attr_expr=None,
351-
offset=None,
352-
limit=None,
353-
select=None,
354-
# ---
355-
expect_error="[] is not of type 'string'",
356-
)
357-
358-
def test_aql_error(self):
359-
for sciname in scinames_test_all:
360-
_fulltext_search_query(
361-
self,
362-
coll="ncbi_taxon",
363-
search_attrkey="fake_attrkey",
364-
search_text=sciname,
365-
ts=None,
366-
filter_attr_expr=None,
367-
offset=None,
368-
limit=None,
369-
select=None,
370-
# ---
371-
expect_error=True,
372-
)
373-
374-
def test_no_hit(self):
375-
for sciname in scinames_test_all:
376-
_fulltext_search_query(
377-
self,
378-
coll="ncbi_taxon",
379-
search_attrkey="scientific_name",
380-
search_text=sciname[::-1],
381-
ts=None,
382-
filter_attr_expr=None,
383-
offset=None,
384-
limit=None,
385-
select=None,
386-
# ---
387-
expect_error=False,
388-
expect_hit=False,
389-
expected_hits=[],
390-
)
391-
392-
393-
# --- Test helpers ---
394-
395-
396251
def _switch_taxonomy_search_species_strain_queries(search_text):
397252
return (
398253
"taxonomy_search_species_strain_no_sort"

0 commit comments

Comments
 (0)