def test_is_a_list_immediately(self): s = BigCharListModel() assert s.field == [] s.field.append("bold") s.field.append("brave") s.save() assert s.field == ["bold", "brave"] s = BigCharListModel.objects.get(id=s.id) assert s.field == ["bold", "brave"]
def test_dumping(self): instance = BigCharListModel(field=["big", "comfy"]) data = json.loads(serializers.serialize('json', [instance]))[0] field = data['fields']['field'] assert sorted(field.split(',')) == ["big", "comfy"]
def test_dumping_loading_empty(self): instance = BigCharListModel(field=[]) data = serializers.serialize('json', [instance]) objs = list(serializers.deserialize('json', data)) instance = objs[0].object assert instance.field == []