'Testing NULL geometry support, and the `isnull` lookup type.'

@no_mysql
def test_null_geometries(self):

    State.objects.create(name='Puerto    Rico')
    nullqs = State.objects.filter(poly__isnull=True)
    validqs = State.objects.filter(poly__isnull=False)
    self.assertEqual(1, len(nullqs))
    self.assertEqual('Puerto    Rico', nullqs[0].name)
    self.assertEqual(2, len(validqs))
    state_names = [s.name for s in validqs]
    self.assertEqual(True, ('Colorado' in state_names))
    self.assertEqual(True, ('Kansas' in state_names))
    nmi = State.objects.create(name='Northern    Mariana    Islands', poly=None)
    self.assertEqual(nmi.poly, None)
    nmi.poly = 'POLYGON((0    0,1    0,1    1,1    0,0    0))'
    nmi.save()
    State.objects.filter(name='Northern    Mariana    Islands').update(poly=None)
    self.assertEqual(None, State.objects.get(name='Northern    Mariana    Islands').poly)
