def test_escrita_campo_alfa(self):
        # Testa que serao aceitos apenas unicode objects
        with self.assertRaises(errors.TipoError):
            self.header_arquivo.cedente_nome = 'tracy'

        # Testa que strings mais longas que obj.digitos nao serao aceitas
        with self.assertRaises(errors.NumDigitosExcedidoError):
            self.header_arquivo.cedente_convenio = '123456789012345678901'

        # Testa que o valor atribuido foi guardado no objeto
        self.header_arquivo.cedente_nome = 'tracy'
        self.assertEqual(self.header_arquivo.cedente_nome, 'tracy')
def insert(self, path, matchrecursive=True, globpats=None, repats=None):
        """Insert a directory path to this tree.

        If matchrecursive is True, mark the directory as unconditionally
        include files and subdirs recursively.

        If globpats or repats are specified, append them to the patterns being
        applied at this directory. The tricky part is those patterns can match
        "x/y/z" and visit("x"), visit("x/y") need to return True, while we
        still want visit("x/a") to return False.
        """
        if path == "":
            self.matchrecursive |= matchrecursive
            if globpats:
                # Need to match parent directories too.
                for pat in globpats:
                    components = _globpatsplit(pat)
                    parentpat = ""
                    for comp in components:
                        if parentpat:
                            parentpat += "/"
                        parentpat += comp
                        if "/" in comp:
                            # Giving up - fallback to slow paths.
                            self.unsurerecursive = True
                        self._globdirpats.append(parentpat)
                if any("**" in p for p in globpats):
                    # Giving up - "**" matches paths including "/"
                    self.unsurerecursive = True
                self._kindpats += [("glob", pat, "") for pat in globpats]
            if repats:
                if not all(map(_testrefastpath, repats)):
                    # Giving up - fallback to slow paths.
                    self.unsurerecursive = True
                self._kindpats += [("re", pat, "") for pat in repats]
            return

        subdir, rest = self._split(path)
        self.setdefault(subdir, _tree()).insert(rest, matchrecursive, globpats, repats)