GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — sqlobject/sqlobject/tests/test_jsoncol.py at master · sqlobject/sqlobject Expand file tree/ Copy pathtest_jsoncol.pyMore file actions 56 lines (43 loc) · 1.47 KB / Copy pathtest_jsoncol.pyFile metadata and controls56 lines (43 loc) · 1.47 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 import pytest from sqlobject import SQLObject, JSONCol from sqlobject.tests.dbtest import setupClass class JSONTest(SQLObject): json = JSONCol(default=None) _json_test_data = ( None, True, 1, 2.0, {u"test": [None, True, 1, 2.0, {u"unicode'with'apostrophes": u"unicode\"with\"quotes"}, [], u"unicode"]}, [None, True, 1, 2.0, [], {u"unicode'with'apostrophes": u"unicode\"with\"quotes"}, u"unicode", u"unicode'with'apostrophes", u"unicode\"with\"quotes", ], u"unicode", u"unicode'with'apostrophes", u"unicode\"with\"quotes", {'test': 'Test'}, ) def _setup(): setupClass(JSONTest) for _id, test_data in enumerate(_json_test_data): JSONTest(id=_id + 1, json=test_data) def test_JSONCol(): _setup() JSONTest._connection.cache.clear() for _id, test_data in enumerate(_json_test_data): json = JSONTest.get(_id + 1) assert json.json == test_data def test_JSONCol_funcs(): connection = JSONTest._connection if not hasattr(connection, 'can_use_json_funcs') \ or not connection.can_use_json_funcs(): pytest.skip( "The database doesn't support JSON functions; " "JSON functions are supported by MariaDB since version 10.2.7 " "and by MySQL since version 5.7.") _setup() rows = list( JSONTest.select(JSONTest.q.json.json_extract('test') == 'Test') ) assert len(rows) == 1 assert rows[0].json == {'test': 'Test'} |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |