def test_abspath(self): self.assert_(macpath.abspath("xx:yy") == "xx:yy") # Issue 3426: check that abspath retuns unicode when the arg is unicode # and str when it's str, with both ASCII and non-ASCII cwds saved_cwd = os.getcwd() cwds = ["cwd"] try: cwds.append(u"\xe7w\xf0".encode(sys.getfilesystemencoding() or "ascii")) except UnicodeEncodeError: pass # the cwd can't be encoded -- test with ascii cwd only for cwd in cwds: try: os.mkdir(cwd) os.chdir(cwd) for path in ("", "foo", "f\xf2\xf2", "/foo", "C:\\"): self.assertTrue(isinstance(macpath.abspath(path), str)) for upath in (u"", u"fuu", u"f\xf9\xf9", u"/fuu", u"U:\\"): self.assertTrue(isinstance(macpath.abspath(upath), unicode)) finally: os.chdir(saved_cwd) os.rmdir(cwd)
def test_abspath(self): self.assert_(macpath.abspath("xx:yy") == "xx:yy") # Issue 3426: check that abspath retuns unicode when the arg is unicode # and str when it's str, with both ASCII and non-ASCII cwds saved_cwd = os.getcwd() cwds = ['cwd'] try: cwds.append(u'\xe7w\xf0'.encode(sys.getfilesystemencoding() or 'ascii')) except UnicodeEncodeError: pass # the cwd can't be encoded -- test with ascii cwd only for cwd in cwds: try: os.mkdir(cwd) os.chdir(cwd) for path in ('', 'foo', 'f\xf2\xf2', '/foo', 'C:\\'): self.assertTrue(isinstance(macpath.abspath(path), str)) for upath in (u'', u'fuu', u'f\xf9\xf9', u'/fuu', u'U:\\'): self.assertTrue(isinstance(macpath.abspath(upath), unicode)) finally: os.chdir(saved_cwd) os.rmdir(cwd)
def test_abspath(self): self.assert_(macpath.abspath("xx:yy") == "xx:yy")
def test_abspath(self): self.assertEqual(macpath.abspath("xx:yy"), "xx:yy")
def get_tens(iter): global cargo while 1: print "\nTENS State: ", while jump_to(cargo) == 'TENS': print "#%2.1f " % cargo, cargo = iter.next() yield (jump_to(cargo), cargo) def exit(iter): jump = raw_input('\n\n[co-routine for jump?] ').upper() print "...Jumping into middle of", jump yield (jump, iter.next()) print "\nExiting from exit()..." sys.exit() def toJSON(input): reader = Reader(input) parser = Parser(reader, asJson=True) return json.dumps(parser.runtime) # num_stream = math_gen(1) # cargo = num_stream.next() # gendct = {'ONES': get_ones(num_stream),'TENS': get_tens(num_stream), 'OUT_OF_RANGE': exit(num_stream)} # scheduler(gendct, jump_to(cargo)) if __name__ == "__main__": DIR = dirname(abspath(__file__)) TOMLFiles = glob(join(DIR, '*.toml')) if __name__ == '__main__': for filename in TOMLFiles: with open(filename) as file: print toJSON(file)