Ejemplo n.º 1
0
 def test_obj(self):
     o = object()
     with util.maybe_tempfile(o, prefix='tmp') as tf:
         self.assertEqual(o, tf)
Ejemplo n.º 2
0
 def test_obj(self):
     o = object()
     with util.maybe_tempfile(o, prefix='tmp') as tf:
         self.assertEqual(o, tf)
Ejemplo n.º 3
0
 def test_tempfile(self):
     with util.maybe_tempfile(prefix='tmp') as tf:
         self.assertFalse(tf.closed)
         self.assertTrue(os.path.basename(tf.name).startswith('tmp'))
     self.assertTrue(tf.closed)
     self.assertFalse(os.path.exists(tf.name))
Ejemplo n.º 4
0
 def test_tempfile(self):
     with util.maybe_tempfile(prefix='tmp') as tf:
         self.assertFalse(tf.closed)
         self.assertTrue(os.path.basename(tf.name).startswith('tmp'))
     self.assertTrue(tf.closed)
     self.assertFalse(os.path.exists(tf.name))