From 33416886f7021c52a1c11b2ffb096d81642f85d1 Mon Sep 17 00:00:00 2001 From: Fabsolute Date: Mon, 13 Nov 2017 16:59:35 +0300 Subject: [PATCH 1/2] FIX start_key and end_key usage --- couchdb/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchdb/client.py b/couchdb/client.py index 6125e831..a686c6a2 100644 --- a/couchdb/client.py +++ b/couchdb/client.py @@ -1271,7 +1271,7 @@ def _encode_view_options(options): """ retval = {} for name, value in options.items(): - if name in ('key', 'startkey', 'endkey') \ + if name in ('key', 'startkey', 'endkey', 'start_key', 'end_key') \ or not isinstance(value, util.strbase): value = json.encode(value) retval[name] = value From be3f1d151e8ca9db03fc326261d5ba452eea7920 Mon Sep 17 00:00:00 2001 From: Fabsolute Date: Mon, 13 Nov 2017 17:17:09 +0300 Subject: [PATCH 2/2] ADD test_start_key --- couchdb/tests/client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/couchdb/tests/client.py b/couchdb/tests/client.py index c21f3940..1669646a 100644 --- a/couchdb/tests/client.py +++ b/couchdb/tests/client.py @@ -939,7 +939,13 @@ def test_startkey(self): [self.docfromnum(x) for x in range(self.num_docs - 2, self.num_docs)]) self.assertEqual([self.docfromrow(doc) for doc in self.db.iterview('test/nums', 10, startkey=1, descending=True)], [self.docfromnum(x) for x in range(3, -1, -1)]) - + + def test_start_key(self): + self.assertEqual([self.docfromrow(doc) for doc in self.db.iterview('test/nums', 10, start_key=int(self.num_docs / 2) - 1)], + [self.docfromnum(x) for x in range(self.num_docs - 2, self.num_docs)]) + self.assertEqual([self.docfromrow(doc) for doc in self.db.iterview('test/nums', 10, start_key=1, descending=True)], + [self.docfromnum(x) for x in range(3, -1, -1)]) + def test_nullkeys(self): self.assertEqual(len(list(self.db.iterview('test/nulls', 10))), self.num_docs)