コード例 #1
0
    def test_missing_funcwin_file_split(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        assert _clean_name_variable("s-6") == "s_6"
        assert _get_format_zero_nb_integer(5006) == "%04d"
        ioout = [io.StringIO(), io.StringIO()]
        if sys.version_info[0] == 2:
            warnings.warn("skip testing Python 2.7")
            return
        file_split(os.path.abspath(__file__), out=ioout, header=True)
        ioout = [io.StringIO(), io.StringIO()]
        s1 = ioout[0].getvalue()
        s2 = ioout[0].getvalue()
        self.assertEqual(s1[:5], s2[:5])
        nb = file_split(os.path.abspath(__file__), out=ioout, header=False)
        size = os.stat(os.path.abspath(__file__)).st_size
        sa = 0
        for l in ioout:
            s = l.getvalue()
            assert len(s) > 0
            sa += len(s)
        assert 0 < sa <= size
        if sa not in (size, size - nb - 1, size - nb, size - 1):
            raise Exception("{0} != {1}, nb={2}".format(sa, size, nb))
コード例 #2
0
    def test_missing_funcwin(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        assert _clean_name_variable("s-6") == "s_6"
        assert _get_format_zero_nb_integer(5006) == "%04d"
        ioout = io.StringIO()
        file_list(os.path.abspath(os.path.dirname(__file__)), out=ioout)
        s = ioout.getvalue()
        assert len(s) > 0