def isGSE2(filename): """ Checks whether a file is GSE2 or not. :type filename: string :param filename: GSE2 file to be checked. :rtype: bool :return: ``True`` if a GSE2 file. """ # Open file. try: with open(filename) as f: libgse2.isGse2(f) except: return False return True
def isGSE2(filename): """ Checks whether a file is GSE2 or not. :type filename: string :param filename: GSE2 file to be checked. :rtype: bool :return: ``True`` if a GSE2 file. """ # Open file. try: with open(filename, 'rb') as f: libgse2.isGse2(f) except: return False return True
def test_isWidi2(self): """ See if first 4 characters are WID2, if not raise type error. """ f = open(os.path.join(self.path, 'loc_RNON20040609200559.z'), 'rb') pos = f.tell() self.assertEqual(None, libgse2.isGse2(f)) self.assertEqual(pos, f.tell()) f.seek(10) self.assertRaises(TypeError, libgse2.isGse2, f) self.assertEqual(10, f.tell())