mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 11:49:12 +00:00 
			
		
		
		
	Don't try to close a non-open file.
Don't let file removal cause the test to fail.
This commit is contained in:
		
							parent
							
								
									88440960f9
								
							
						
					
					
						commit
						be9160b035
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -283,15 +283,15 @@ class TestJointOps(unittest.TestCase):
 | 
				
			||||||
        w = ReprWrapper()
 | 
					        w = ReprWrapper()
 | 
				
			||||||
        s = self.thetype([w])
 | 
					        s = self.thetype([w])
 | 
				
			||||||
        w.value = s
 | 
					        w.value = s
 | 
				
			||||||
 | 
					        fo = open(test_support.TESTFN, "wb")
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            fo = open(test_support.TESTFN, "wb")
 | 
					 | 
				
			||||||
            print >> fo, s,
 | 
					            print >> fo, s,
 | 
				
			||||||
            fo.close()
 | 
					            fo.close()
 | 
				
			||||||
            fo = open(test_support.TESTFN, "rb")
 | 
					            fo = open(test_support.TESTFN, "rb")
 | 
				
			||||||
            self.assertEqual(fo.read(), repr(s))
 | 
					            self.assertEqual(fo.read(), repr(s))
 | 
				
			||||||
        finally:
 | 
					        finally:
 | 
				
			||||||
            fo.close()
 | 
					            fo.close()
 | 
				
			||||||
            os.remove(test_support.TESTFN)
 | 
					            test_support.unlink(test_support.TESTFN)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_do_not_rehash_dict_keys(self):
 | 
					    def test_do_not_rehash_dict_keys(self):
 | 
				
			||||||
        n = 10
 | 
					        n = 10
 | 
				
			||||||
| 
						 | 
					@ -626,15 +626,15 @@ class TestBasicOps(unittest.TestCase):
 | 
				
			||||||
            self.assertEqual(repr(self.set), self.repr)
 | 
					            self.assertEqual(repr(self.set), self.repr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_print(self):
 | 
					    def test_print(self):
 | 
				
			||||||
 | 
					        fo = open(test_support.TESTFN, "wb")
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            fo = open(test_support.TESTFN, "wb")
 | 
					 | 
				
			||||||
            print >> fo, self.set,
 | 
					            print >> fo, self.set,
 | 
				
			||||||
            fo.close()
 | 
					            fo.close()
 | 
				
			||||||
            fo = open(test_support.TESTFN, "rb")
 | 
					            fo = open(test_support.TESTFN, "rb")
 | 
				
			||||||
            self.assertEqual(fo.read(), repr(self.set))
 | 
					            self.assertEqual(fo.read(), repr(self.set))
 | 
				
			||||||
        finally:
 | 
					        finally:
 | 
				
			||||||
            fo.close()
 | 
					            fo.close()
 | 
				
			||||||
            os.remove(test_support.TESTFN)
 | 
					            test_support.unlink(test_support.TESTFN)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_length(self):
 | 
					    def test_length(self):
 | 
				
			||||||
        self.assertEqual(len(self.set), self.length)
 | 
					        self.assertEqual(len(self.set), self.length)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue