def test_necessario(self):
        self.assertTrue(self.seg_p)

        seg_p2 = itau.registros.SegmentoP()
        self.assertFalse(seg_p2.necessario())

        seg_p2.controle_banco = 33
        self.assertFalse(seg_p2.necessario())

        seg_p2.vencimento_titulo = 10102012
        self.assertTrue(seg_p2.necessario())
def __exit__(self, exc_type, exc_value, traceback):
        connection = get_connection(self.using)
        try:
            self._no_monkey.__exit__(self, exc_type, exc_value, traceback)
        except DatabaseError:
            transaction_states[self.using].rollback()
        else:
            if not connection.closed_in_transaction and exc_type is None and \
                    not connection.needs_rollback:
                if transaction_states[self.using]:
                    transaction_states[self.using].commit()
            else:
                transaction_states[self.using].rollback()