Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

Commit

Permalink
Added unittest for testing hstore and json converters
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Kutikin committed Aug 3, 2015
1 parent 87a4a7b commit aa63fb4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,20 @@ def test_connection_factory(self):
cursor = yield db.execute("SELECT 1 AS a")
self.assertEqual(cursor.fetchone(), {"a": 1})

@gen_test
def test_cursor_factory_with_extensions(self):
"""Testing that NamedTupleCursor factory is working with hstore and json"""
db = yield self.build_pool(cur_factory=NamedTupleCursor)

yield db.register_hstore()
yield db.register_json()

cursor = yield self.db.execute("SELECT 'a=>b, c=>d'::hstore;")
self.assertEqual(cursor.fetchall(), [({"a": "b", "c": "d"},)])

cursor = yield self.db.execute("SELECT %s;", ({'e': 'f', 'g': 'h'},))
self.assertEqual(cursor.fetchall(), [({"e": "f", "g": "h"},)])


class MomokoPoolParallelTest(PoolBaseTest):
pool_size = 1
Expand Down

0 comments on commit aa63fb4

Please sign in to comment.