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 each(f):
        if f.body:
            f.hashes = []
            for hash_type, h in HashFile.extract_hashes(f.body.contents):
                hash_object = Hash.get_or_create(value=h.hexdigest())
                hash_object.add_source("analytics")
                hash_object.save()
                f.active_link_to(
                    hash_object,
                    "{} hash".format(hash_type.upper()),
                    "HashFile",
                    clean_old=False,
                )
                f.hashes.append({"hash": hash_type, "value": h.hexdigest()})
            f.save()