I am running through a little strange behaviour on my test cases with django-hstore.
I am working on a django rest framework project and models may look like below
models
from django_hstore.hstore import DictionaryField
class Config(models.Model):
data = data = DictionaryField(db_index=True)
And i am trying to test a scenario based on Config model and does something like this
Tests
class ConfigTestCase(TestCase):
def setUp(self):
Config.objects.create(data={'pagination_number': '50'})
def test_config_data(self):
# Below code is getting failed
Config.objects.first().data.get('pagination_number')
When i do Config.objects.first().data
i am getting '"pagination_number"=>"50"'
i was expecting {'pagination_number': 50}
This is happening only when i run tests
When i am performing create operation on my command shell manually everything works fine and code also executes fine
I am using django-hstore 1.2.1
PostgreSQL 9.4.4
I am unable to figure out the reason for this