def test_sameopenfile(self): with TemporaryFile() as tf1, TemporaryFile() as tf2: self.assertTrue(ntpath.sameopenfile(tf1.fileno(), tf1.fileno())) self.assertFalse(ntpath.sameopenfile(tf1.fileno(), tf2.fileno())) if sys.platform == 'win32': with self.assertRaises(OSError): ntpath.sameopenfile(-1, -1)
def test_sameopenfile(self): with TemporaryFile() as tf1, TemporaryFile() as tf2: # Make sure the same file is really the same self.assertTrue(ntpath.sameopenfile(tf1.fileno(), tf1.fileno())) # Make sure different files are really different self.assertFalse(ntpath.sameopenfile(tf1.fileno(), tf2.fileno())) # Make sure invalid values don't cause issues on win32 if sys.platform == "win32": with self.assertRaises(OSError): # Invalid file descriptors shouldn't display assert # dialogs (#4804) ntpath.sameopenfile(-1, -1)
def update_event(self, inp=-1): self.set_output_val(0, ntpath.sameopenfile(self.input(0), self.input(1)))