def test_basic(self): m = NullBit1Model() assert m.flag is None m.save() m = NullBit1Model.objects.get(id=m.id) print(m.flag) print(type(m.flag)) assert m.flag is None m.flag = True m.save() m = NullBit1Model.objects.get(id=m.id) assert m.flag m.flag = False m.save() m = NullBit1Model.objects.get(id=m.id) assert m.flag is not None and not m.flag
def test_dumping(self): instance = NullBit1Model(flag=None) data = json.loads(serializers.serialize('json', [instance]))[0] fields = data['fields'] assert fields['flag'] is None