Skip to content

Commit

Permalink
prepare 0.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
barseghyanartur committed Jun 5, 2018
1 parent 617cb0a commit a349297
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 19 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ are used for versioning (schema follows below):
0.3.4 to 0.4).
- All backwards incompatible changes are mentioned in this document.

0.8.2
-----
2018-06-05

- Minor fixes.

0.8.1
-----
2018-06-05
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ are used for versioning (schema follows below):
0.3.4 to 0.4).
- All backwards incompatible changes are mentioned in this document.

0.8.2
-----
2018-06-05

- Minor fixes.

0.8.1
-----
2018-06-05
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from setuptools import find_packages, setup

version = '0.8.1'
version = '0.8.2'

DOCS_TRANSFORMATIONS = (
(
Expand Down
2 changes: 1 addition & 1 deletion src/django_elasticsearch_dsl_drf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

__title__ = 'django-elasticsearch-dsl-drf'
__version__ = '0.8.1'
__version__ = '0.8.2'
__author__ = 'Artur Barseghyan <[email protected]>'
__copyright__ = '2017-2018 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,12 @@ def serialize_queryset(self,
hits.append(hit)

data = {
suggester_name: {
suggester_name: [{
'text': value,
'options': hits,
'length': len(value),
'offset': 0,
},
}],
'_shards': result['_shards'],
}
return data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,16 @@ def _test_suggesters(self, test_data, url):

for _test_case, _expected_results in _test_cases.items():
# Check if response now is valid

response = self.client.get(
url + '?' + _suggester_field + '=' + _test_case,
data
)
# import pytest; pytest.set_trace()
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIn(_suggester_field, response.data)
_unique_options = list(set([
__o['text']
for __o
in response.data[_suggester_field]['options']
in response.data[_suggester_field][0]['options']
]))
self.assertEqual(
len(_unique_options),
Expand Down
24 changes: 12 additions & 12 deletions src/django_elasticsearch_dsl_drf/tests/test_suggesters.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,30 +189,30 @@ def _test_suggesters(self, test_data, url):

data = {}

for __suggester_field, __test_cases in test_data.items():
for _suggester_field, _test_cases in test_data.items():

for __test_case, __expected_results in __test_cases.items():
for _test_case, _expected_results in _test_cases.items():
# Check if response now is valid
response = self.client.get(
url + '?' + __suggester_field + '=' + __test_case,
url + '?' + _suggester_field + '=' + _test_case,
data
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIn(__suggester_field, response.data)
__unique_options = list(set([
self.assertIn(_suggester_field, response.data)
_unique_options = list(set([
__o['text']
for __o
in response.data[__suggester_field][0]['options']
in response.data[_suggester_field][0]['options']
]))
self.assertEqual(
len(__unique_options),
len(__expected_results),
(__test_case, __expected_results)
len(_unique_options),
len(_expected_results),
(_test_case, _expected_results)
)
self.assertEqual(
sorted(__unique_options),
sorted(__expected_results),
(__test_case, __expected_results)
sorted(_unique_options),
sorted(_expected_results),
(_test_case, _expected_results)
)

def test_suggesters_completion(self):
Expand Down

0 comments on commit a349297

Please sign in to comment.