#!/usr/bin/python # Copyright (c) 2005-2006 by Mark T. Holder # Florida State University. (see end of file) # New file (post April, 2006, expected to be clean under pylint) '''Verifies that the version of python being used has support for newlines''' import unittest import os from PIPRes.testing import silentAssertRaises from PIPRes.util.io import expandPath, cipresGetLogger _LOG = cipresGetLogger('test.service_impl.paup_wrap_tree_infer') testFilesDir = os.path.join(os.path.dirname(__file__), 'files') class NewlineTest(unittest.TestCase): def implReadFile(self, fp): try: f = open(fp, 'rU') return f.readlines() except: return None def testStoredFile(self): filePostfixes = ['Temp.tre'] otherFilePrefixes = ['mac', 'win'] refPrefix = 'unix' for post in filePostfixes: refFp = expandPath(os.path.join(testFilesDir, refPrefix + post)) refContent = self.implReadFile(refFp) if refContent is None: _LOG.warn('%s not found!, test skipped.' % refFp) else: for pre in otherFilePrefixes: fn = pre + post fp = expandPath(os.path.join(testFilesDir, fn)) content = self.implReadFile(fp) if content is None: _LOG.warn('%s not found!, test skipped.' % fp) else: self.assertEqual(content, refContent) if __name__ == '__main__': unittest.main() # self.assertEqual() # silentAssertRaises(self, ) # This file is part of the PIPRes library # # The PIPRes library is free software; you can redistribute it # and/or modify it under the terms of the GNU Lesser General # Public License as published by the Free Software Foundation; # either version 2.1 of the License, or (at your option) any later # version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # MA 02111-1307, USA