def test_expand_wildcard(self): '''test wildcard expansion of sos_targets''' a = sos_targets('*.py') self.assertGreater(len(a), 1) # a = paths('*.py') self.assertGreater(len(a), 1)
def test_expand_wildcard(self): """test wildcard expansion of sos_targets""" a = sos_targets("*.py") self.assertGreater(len(a), 1) # a = paths("*.py") self.assertGreater(len(a), 1)
def test_zap(self): '''Test zap''' with open('testzap.txt', 'w') as sf: sf.write('some text') path('testzap.txt').zap() self.assertTrue(os.path.isfile('testzap.txt.zapped')) self.assertFalse(os.path.isfile('testzap.txt')) # re-zap is ok file_target('testzap.txt').zap() self.assertTrue(os.path.isfile('testzap.txt.zapped')) self.assertFalse(os.path.isfile('testzap.txt')) # non-existent file os.remove('testzap.txt.zapped') self.assertRaises(FileNotFoundError, path('testzap.txt').zap) # with open('testzap.txt', 'w') as sf: sf.write('some text') with open('testzap1.txt', 'w') as sf: sf.write('some text') paths('testzap.txt', 'testzap1.txt').zap() self.assertTrue(os.path.isfile('testzap.txt.zapped')) self.assertFalse(os.path.isfile('testzap.txt')) self.assertTrue(os.path.isfile('testzap1.txt.zapped')) self.assertFalse(os.path.isfile('testzap1.txt')) # os.remove('testzap.txt.zapped') os.remove('testzap1.txt.zapped') with open('testzap.txt', 'w') as sf: sf.write('some text') with open('testzap1.txt', 'w') as sf: sf.write('some text') sos_targets(['testzap.txt', 'testzap1.txt']).zap() self.assertTrue(os.path.isfile('testzap.txt.zapped')) self.assertFalse(os.path.isfile('testzap.txt')) self.assertTrue(os.path.isfile('testzap1.txt.zapped')) self.assertFalse(os.path.isfile('testzap1.txt'))
def test_zap(self): """Test zap""" with open("testzap.txt", "w") as sf: sf.write("some text") path("testzap.txt").zap() self.assertTrue(os.path.isfile("testzap.txt.zapped")) self.assertFalse(os.path.isfile("testzap.txt")) # re-zap is ok file_target("testzap.txt").zap() self.assertTrue(os.path.isfile("testzap.txt.zapped")) self.assertFalse(os.path.isfile("testzap.txt")) # non-existent file os.remove("testzap.txt.zapped") self.assertRaises(FileNotFoundError, path("testzap.txt").zap) # with open("testzap.txt", "w") as sf: sf.write("some text") with open("testzap1.txt", "w") as sf: sf.write("some text") paths("testzap.txt", "testzap1.txt").zap() self.assertTrue(os.path.isfile("testzap.txt.zapped")) self.assertFalse(os.path.isfile("testzap.txt")) self.assertTrue(os.path.isfile("testzap1.txt.zapped")) self.assertFalse(os.path.isfile("testzap1.txt")) # os.remove("testzap.txt.zapped") os.remove("testzap1.txt.zapped") with open("testzap.txt", "w") as sf: sf.write("some text") with open("testzap1.txt", "w") as sf: sf.write("some text") sos_targets(["testzap.txt", "testzap1.txt"]).zap() self.assertTrue(os.path.isfile("testzap.txt.zapped")) self.assertFalse(os.path.isfile("testzap.txt")) self.assertTrue(os.path.isfile("testzap1.txt.zapped")) self.assertFalse(os.path.isfile("testzap1.txt"))