Fix jsonb_plpython tests on older Python versions

Rewrite one test to avoid a case where some Python versions have output
format differences (Decimal('1') vs Decimal("1")).
This commit is contained in:
Peter Eisentraut 2018-03-28 11:01:40 -04:00
parent 3f44e3db72
commit e81fc9b9db
2 changed files with 2 additions and 3 deletions

View File

@ -6,11 +6,10 @@ LANGUAGE plpythonu
TRANSFORM FOR TYPE jsonb
AS $$
assert isinstance(val, dict)
plpy.info(sorted(val.items()))
assert(val == {'a': 1, 'c': 'NULL'})
return len(val)
$$;
SELECT test1('{"a": 1, "c": "NULL"}'::jsonb);
INFO: [('a', Decimal('1')), ('c', 'NULL')]
test1
-------
2

View File

@ -6,7 +6,7 @@ LANGUAGE plpythonu
TRANSFORM FOR TYPE jsonb
AS $$
assert isinstance(val, dict)
plpy.info(sorted(val.items()))
assert(val == {'a': 1, 'c': 'NULL'})
return len(val)
$$;