[Python-checkins] CVS: python/dist/src/Lib/test test_netrc.py,NONE,1.1 test_sundry.py,1.8,1.9
A.M. Kuchling
akuchling@users.sourceforge.net
Thu, 21 Mar 2002 18:48:59 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv13910
Modified Files:
test_sundry.py
Added Files:
test_netrc.py
Log Message:
Add a simple test suite for netrc.py, and remove it from test_sundry
--- NEW FILE: test_netrc.py ---
import netrc, os, tempfile, test_support, unittest
TEST_NETRC = """
machine foo login log1 password pass1 account acct1
macdef macro1
line1
line2
macdef macro2
line3
line4
default login log2 password pass2
"""
temp_filename = tempfile.mktemp()
class NetrcTestCase(unittest.TestCase):
def setUp (self):
fp = open(temp_filename, 'wt')
fp.write(TEST_NETRC)
fp.close()
self.netrc = netrc.netrc(temp_filename)
def tearDown (self):
del self.netrc
os.unlink(temp_filename)
def test_case_1(self):
self.assert_(self.netrc.macros == {'macro1':['line1\n', 'line2\n'],
'macro2':['line3\n', 'line4\n']}
)
self.assert_(self.netrc.hosts['foo'] == ('log1', 'acct1', 'pass1'))
self.assert_(self.netrc.hosts['default'] == ('log2', None, 'pass2'))
if __name__ == "__main__":
test_support.run_unittest(NetrcTestCase)
Index: test_sundry.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sundry.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** test_sundry.py 7 Dec 2001 16:43:19 -0000 1.8
--- test_sundry.py 22 Mar 2002 02:48:57 -0000 1.9
***************
*** 56,60 ****
import multifile
import mutex
- import netrc
import nntplib
import nturl2path
--- 56,59 ----