'Test to ensure that update using IF and not equals are honored correctly
@since 3.2
@jira_ticket PYTHON-328
@expected_result update conditional with NE should be honored
@test_category object_mapper'

@greaterthancass20
def test_update_lwt_ne(self):

    t = TestConditionalModel.create(text='something', count=5)
    self.assertEqual(TestConditionalModel.objects(id=t.id).count(), 1)
    with self.assertRaises(LWTException):
        t.iff(count__ne=5).update(text='nothing')
    t.iff(count__ne=2).update(text='nothing')
    self.assertEqual(TestConditionalModel.objects(id=t.id).first().text, 'nothing')
    t.delete()
    t = TestConditionalModel.create(text='something', count=5)
    self.assertEqual(TestConditionalModel.objects(id=t.id).count(), 1)
    with self.assertRaises(LWTException):
        TestConditionalModel.objects(id=t.id).iff(count__ne=5).update(text='nothing')
    TestConditionalModel.objects(id=t.id).iff(count__ne=2).update(text='nothing')
    self.assertEqual(TestConditionalModel.objects(id=t.id).first().text, 'nothing')
    t.delete()
