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

@skipUnlessDBFeature('supports_null_geometries')
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.assertIn('Colorado', state_names)
    self.assertIn('Kansas', state_names)
    nmi = State.objects.create(name='Northern    Mariana    Islands', poly=None)
    self.assertIsNone(nmi.poly)
    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.assertIsNone(State.objects.get(name='Northern    Mariana    Islands').poly)
