def test_head2(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") fp = os.path.join( os.path.dirname( os.path.abspath(__file__)), "data", "Exportutf8.txt") mg = MagicFile() fLOG("--", fp) res = mg.head("{0} -n 3".format(fp)) fLOG("*****", res) res = mg.head("{0} -n=3".format(fp)) fLOG("*****", res) res = mg.head("{0}".format(fp)) fLOG("*****", res) assert "9.0" in res.data res = mg.head("{0} --n 3 -e utf8".format(fp)) try: res = mg.head("Exportutf8.txt") except FileNotFoundError: pass
def test_head(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") fp = os.path.abspath(__file__) mg = MagicFile() fLOG("--", fp) res = mg.head("{0} -n 3".format(fp)) fLOG("*****", res) assert "test log" in res.data res = mg.head("{0} --n 3 -e ascii".format(fp)) resr = mg.head("{0} --n 3 -e utf8 --raw".format(fp)) fLOG(resr) assert resr != res assert "<" not in resr assert "@brief" in resr assert "usage" not in resr assert not isinstance(res, str)
def test_head(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") fp = os.path.abspath(__file__) mg = MagicFile() fLOG("--", fp) res = mg.head("{0} -n 3".format(fp)) fLOG("*****", res) assert "test log" in res.data res = mg.head("{0} --n 3 -e ascii".format(fp)) resr = mg.head("{0} --n 3 -e utf8 --raw".format(fp)) fLOG(resr) assert resr != res assert "<" not in resr assert "@brief" in resr assert "usage" not in resr assert not isinstance(res, str)
def test_head2(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") fp = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data", "Exportutf8.txt") mg = MagicFile() fLOG("--", fp) res = mg.head("{0} -n 3".format(fp)) fLOG("*****", res) res = mg.head("{0} -n=3".format(fp)) fLOG("*****", res) res = mg.head("{0}".format(fp)) fLOG("*****", res) assert "9.0" in res.data res = mg.head("{0} --n 3 -e utf8".format(fp)) try: res = mg.head("Exportutf8.txt") except FileNotFoundError: pass