Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test showing int keys of a dict are converted to string #9

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions runtests.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os, sys
Expand Down
2 changes: 2 additions & 0 deletions setup.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python

from setuptools import setup, find_packages

description="""
Expand Down
5 changes: 5 additions & 0 deletions tests/pg_json_fields/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ def test_primitives_null(self):
obj = self.model_class.objects.get(pk=obj.pk)
self.assertEqual(obj.data, None)

def test_dict_with_int_key(self):
obj = self.model_class.objects.create(data={10: 5})
obj = self.model_class.objects.get(pk=obj.pk)
self.assertDictEqual(obj.data, {10: 5})

def test_value_to_string_serializes_correctly(self):
obj = self.model_class.objects.create(data={"a": 1})

Expand Down