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