[Python-checkins] python/dist/src/Lib/test test_tempfile.py,1.9,1.10

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Thu, 22 Aug 2002 13:02:05 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv23773

Modified Files:
	test_tempfile.py 
Log Message:
Standardize behavior: no docstrings in test functions.  Also get rid
of dummy_test_TemporaryFile class; when NamedTemporaryFile and
TemporaryFile are the same, simply don't add a test suite for
TemporaryFile.


Index: test_tempfile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** test_tempfile.py	18 Aug 2002 06:47:19 -0000	1.9
--- test_tempfile.py	22 Aug 2002 20:02:03 -0000	1.10
***************
*** 59,63 ****
  class test_exports(TC):
      def test_exports(self):
!         """There are no surprising symbols in the tempfile module"""
          dict = tempfile.__dict__
  
--- 59,63 ----
  class test_exports(TC):
      def test_exports(self):
!         # There are no surprising symbols in the tempfile module
          dict = tempfile.__dict__
  
***************
*** 92,101 ****
  
      def test_get_six_char_str(self):
!         """_RandomNameSequence returns a six-character string"""
          s = self.r.next()
          self.nameCheck(s, '', '', '')
  
      def test_many(self):
!         """_RandomNameSequence returns no duplicate strings (stochastic)"""
  
          dict = {}
--- 92,101 ----
  
      def test_get_six_char_str(self):
!         # _RandomNameSequence returns a six-character string
          s = self.r.next()
          self.nameCheck(s, '', '', '')
  
      def test_many(self):
!         # _RandomNameSequence returns no duplicate strings (stochastic)
  
          dict = {}
***************
*** 108,112 ****
  
      def test_supports_iter(self):
!         """_RandomNameSequence supports the iterator protocol"""
  
          i = 0
--- 108,112 ----
  
      def test_supports_iter(self):
!         # _RandomNameSequence supports the iterator protocol
  
          i = 0
***************
*** 127,131 ****
  
      def test_nonempty_list(self):
!         """_candidate_tempdir_list returns a nonempty list of strings"""
  
          cand = tempfile._candidate_tempdir_list()
--- 127,131 ----
  
      def test_nonempty_list(self):
!         # _candidate_tempdir_list returns a nonempty list of strings
  
          cand = tempfile._candidate_tempdir_list()
***************
*** 137,141 ****
  
      def test_wanted_dirs(self):
!         """_candidate_tempdir_list contains the expected directories"""
  
          # Make sure the interesting environment variables are all set.
--- 137,141 ----
  
      def test_wanted_dirs(self):
!         # _candidate_tempdir_list contains the expected directories
  
          # Make sure the interesting environment variables are all set.
***************
*** 178,187 ****
  
      def test_retval(self):
!         """_get_candidate_names returns a _RandomNameSequence object"""
          obj = tempfile._get_candidate_names()
          self.assert_(isinstance(obj, tempfile._RandomNameSequence))
  
      def test_same_thing(self):
!         """_get_candidate_names always returns the same object"""
          a = tempfile._get_candidate_names()
          b = tempfile._get_candidate_names()
--- 178,187 ----
  
      def test_retval(self):
!         # _get_candidate_names returns a _RandomNameSequence object
          obj = tempfile._get_candidate_names()
          self.assert_(isinstance(obj, tempfile._RandomNameSequence))
  
      def test_same_thing(self):
!         # _get_candidate_names always returns the same object
          a = tempfile._get_candidate_names()
          b = tempfile._get_candidate_names()
***************
*** 226,230 ****
  
      def test_basic(self):
!         """_mkstemp_inner can create files"""
          self.do_create().write("blat")
          self.do_create(pre="a").write("blat")
--- 226,230 ----
  
      def test_basic(self):
!         # _mkstemp_inner can create files
          self.do_create().write("blat")
          self.do_create(pre="a").write("blat")
***************
*** 234,238 ****
  
      def test_basic_many(self):
!         """_mkstemp_inner can create many files (stochastic)"""
          extant = range(TEST_FILES)
          for i in extant:
--- 234,238 ----
  
      def test_basic_many(self):
!         # _mkstemp_inner can create many files (stochastic)
          extant = range(TEST_FILES)
          for i in extant:
***************
*** 240,244 ****
  
      def test_choose_directory(self):
!         """_mkstemp_inner can create files in a user-selected directory"""
          dir = tempfile.mkdtemp()
          try:
--- 240,244 ----
  
      def test_choose_directory(self):
!         # _mkstemp_inner can create files in a user-selected directory
          dir = tempfile.mkdtemp()
          try:
***************
*** 248,252 ****
  
      def test_file_mode(self):
!         """_mkstemp_inner creates files with the proper mode"""
          if not has_stat:
              return            # ugh, can't use TestSkipped.
--- 248,252 ----
  
      def test_file_mode(self):
!         # _mkstemp_inner creates files with the proper mode
          if not has_stat:
              return            # ugh, can't use TestSkipped.
***************
*** 263,267 ****
  
      def test_noinherit(self):
!         """_mkstemp_inner file handles are not inherited by child processes"""
          if not has_spawnl:
              return            # ugh, can't use TestSkipped.
--- 263,267 ----
  
      def test_noinherit(self):
!         # _mkstemp_inner file handles are not inherited by child processes
          if not has_spawnl:
              return            # ugh, can't use TestSkipped.
***************
*** 293,297 ****
  
      def test_textmode(self):
!         """_mkstemp_inner can create files in text mode"""
          if not has_textmode:
              return            # ugh, can't use TestSkipped.
--- 293,297 ----
  
      def test_textmode(self):
!         # _mkstemp_inner can create files in text mode
          if not has_textmode:
              return            # ugh, can't use TestSkipped.
***************
*** 307,311 ****
  
      def test_sane_template(self):
!         """gettempprefix returns a nonempty prefix string"""
          p = tempfile.gettempprefix()
  
--- 307,311 ----
  
      def test_sane_template(self):
!         # gettempprefix returns a nonempty prefix string
          p = tempfile.gettempprefix()
  
***************
*** 314,318 ****
  
      def test_usable_template(self):
!         """gettempprefix returns a usable prefix string"""
  
          # Create a temp directory, avoiding use of the prefix.
--- 314,318 ----
  
      def test_usable_template(self):
!         # gettempprefix returns a usable prefix string
  
          # Create a temp directory, avoiding use of the prefix.
***************
*** 339,343 ****
  
      def test_directory_exists(self):
!         """gettempdir returns a directory which exists"""
  
          dir = tempfile.gettempdir()
--- 339,343 ----
  
      def test_directory_exists(self):
!         # gettempdir returns a directory which exists
  
          dir = tempfile.gettempdir()
***************
*** 348,352 ****
  
      def test_directory_writable(self):
!         """gettempdir returns a directory writable by the user"""
  
          # sneaky: just instantiate a NamedTemporaryFile, which
--- 348,352 ----
  
      def test_directory_writable(self):
!         # gettempdir returns a directory writable by the user
  
          # sneaky: just instantiate a NamedTemporaryFile, which
***************
*** 361,365 ****
  
      def test_same_thing(self):
!         """gettempdir always returns the same object"""
          a = tempfile.gettempdir()
          b = tempfile.gettempdir()
--- 361,365 ----
  
      def test_same_thing(self):
!         # gettempdir always returns the same object
          a = tempfile.gettempdir()
          b = tempfile.gettempdir()
***************
*** 372,375 ****
--- 372,376 ----
  class test_mkstemp(TC):
      """Test mkstemp()."""
+ 
      def do_create(self, dir=None, pre="", suf="", ):
          if dir is None:
***************
*** 387,391 ****
  
      def test_basic(self):
!         """mkstemp can create files"""
          self.do_create()
          self.do_create(pre="a")
--- 388,392 ----
  
      def test_basic(self):
!         # mkstemp can create files
          self.do_create()
          self.do_create(pre="a")
***************
*** 395,399 ****
  
      def test_choose_directory(self):
!         """mkstemp can create directories in a user-selected directory"""
          dir = tempfile.mkdtemp()
          try:
--- 396,400 ----
  
      def test_choose_directory(self):
!         # mkstemp can create directories in a user-selected directory
          dir = tempfile.mkdtemp()
          try:
***************
*** 424,428 ****
  
      def test_basic(self):
!         """mkdtemp can create directories"""
          os.rmdir(self.do_create())
          os.rmdir(self.do_create(pre="a"))
--- 425,429 ----
  
      def test_basic(self):
!         # mkdtemp can create directories
          os.rmdir(self.do_create())
          os.rmdir(self.do_create(pre="a"))
***************
*** 432,436 ****
  
      def test_basic_many(self):
!         """mkdtemp can create many directories (stochastic)"""
          extant = range(TEST_FILES)
          try:
--- 433,437 ----
  
      def test_basic_many(self):
!         # mkdtemp can create many directories (stochastic)
          extant = range(TEST_FILES)
          try:
***************
*** 443,447 ****
  
      def test_choose_directory(self):
!         """mkdtemp can create directories in a user-selected directory"""
          dir = tempfile.mkdtemp()
          try:
--- 444,448 ----
  
      def test_choose_directory(self):
!         # mkdtemp can create directories in a user-selected directory
          dir = tempfile.mkdtemp()
          try:
***************
*** 451,455 ****
  
      def test_mode(self):
!         """mkdtemp creates directories with the proper mode"""
          if not has_stat:
              return            # ugh, can't use TestSkipped.
--- 452,456 ----
  
      def test_mode(self):
!         # mkdtemp creates directories with the proper mode
          if not has_stat:
              return            # ugh, can't use TestSkipped.
***************
*** 512,516 ****
  
      def test_basic(self):
!         """mktemp can choose usable file names"""
          self.do_create()
          self.do_create(pre="a")
--- 513,517 ----
  
      def test_basic(self):
!         # mktemp can choose usable file names
          self.do_create()
          self.do_create(pre="a")
***************
*** 520,524 ****
  
      def test_many(self):
!         """mktemp can choose many usable file names (stochastic)"""
          extant = range(TEST_FILES)
          for i in extant:
--- 521,525 ----
  
      def test_many(self):
!         # mktemp can choose many usable file names (stochastic)
          extant = range(TEST_FILES)
          for i in extant:
***************
*** 526,530 ****
  
      def test_warning(self):
!         """mktemp issues a warning when used"""
          warnings.filterwarnings("error",
                                  category=RuntimeWarning,
--- 527,531 ----
  
      def test_warning(self):
!         # mktemp issues a warning when used
          warnings.filterwarnings("error",
                                  category=RuntimeWarning,
***************
*** 555,559 ****
  
      def test_basic(self):
!         """NamedTemporaryFile can create files"""
          self.do_create()
          self.do_create(pre="a")
--- 556,560 ----
  
      def test_basic(self):
!         # NamedTemporaryFile can create files
          self.do_create()
          self.do_create(pre="a")
***************
*** 563,567 ****
  
      def test_creates_named(self):
!         """NamedTemporaryFile creates files with names"""
          f = tempfile.NamedTemporaryFile()
          self.failUnless(os.path.exists(f.name),
--- 564,568 ----
  
      def test_creates_named(self):
!         # NamedTemporaryFile creates files with names
          f = tempfile.NamedTemporaryFile()
          self.failUnless(os.path.exists(f.name),
***************
*** 569,573 ****
  
      def test_del_on_close(self):
!         """A NamedTemporaryFile is deleted when closed"""
          dir = tempfile.mkdtemp()
          try:
--- 570,574 ----
  
      def test_del_on_close(self):
!         # A NamedTemporaryFile is deleted when closed
          dir = tempfile.mkdtemp()
          try:
***************
*** 581,585 ****
  
      def test_multiple_close(self):
!         """A NamedTemporaryFile can be closed many times without error"""
  
          f = tempfile.NamedTemporaryFile()
--- 582,586 ----
  
      def test_multiple_close(self):
!         # A NamedTemporaryFile can be closed many times without error
  
          f = tempfile.NamedTemporaryFile()
***************
*** 601,605 ****
  
      def test_basic(self):
!         """TemporaryFile can create files"""
          # No point in testing the name params - the file has no name.
          try:
--- 602,606 ----
  
      def test_basic(self):
!         # TemporaryFile can create files
          # No point in testing the name params - the file has no name.
          try:
***************
*** 609,613 ****
  
      def test_has_no_name(self):
!         """TemporaryFile creates files with no names (on this system)"""
          dir = tempfile.mkdtemp()
          f = tempfile.TemporaryFile(dir=dir)
--- 610,614 ----
  
      def test_has_no_name(self):
!         # TemporaryFile creates files with no names (on this system)
          dir = tempfile.mkdtemp()
          f = tempfile.TemporaryFile(dir=dir)
***************
*** 626,630 ****
  
      def test_multiple_close(self):
!         """A TemporaryFile can be closed many times without error"""
          f = tempfile.TemporaryFile()
          f.write('abc\n')
--- 627,631 ----
  
      def test_multiple_close(self):
!         # A TemporaryFile can be closed many times without error
          f = tempfile.TemporaryFile()
          f.write('abc\n')
***************
*** 638,649 ****
      # How to test the mode and bufsize parameters?
  
- class dummy_test_TemporaryFile(TC):
-     def test_dummy(self):
-         """TemporaryFile and NamedTemporaryFile are the same (on this system)"""
-         pass
  
! if tempfile.NamedTemporaryFile is tempfile.TemporaryFile:
!     test_classes.append(dummy_test_TemporaryFile)
! else:
      test_classes.append(test_TemporaryFile)
  
--- 639,644 ----
      # How to test the mode and bufsize parameters?
  
  
! if tempfile.NamedTemporaryFile is not tempfile.TemporaryFile:
      test_classes.append(test_TemporaryFile)