[Happydoc-checkins] CVS: HappyDoc/happydoclib path.py,1.5,1.6
Brought to you by:
doughellmann,
krlosaqp
|
From: Doug H. <dou...@us...> - 2002-02-02 13:49:50
|
Update of /cvsroot/happydoc/HappyDoc/happydoclib
In directory usw-pr-cvs1:/tmp/cvs-serv9645/happydoclib
Modified Files:
path.py
Log Message:
Changed hard-coded test values to use dynamically constructed values
using os.sep, os.pardir, os.curdir, and os.path.join.
Index: path.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/happydoclib/path.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** path.py 2001/11/25 14:13:39 1.5
--- path.py 2002/02/02 13:49:47 1.6
***************
*** 334,339 ****
def testApplyPrefixToPath(self):
! expected = '/BLAH_tmp/BLAH_foo'
! actual = applyPrefixToPath('/tmp/foo', 'BLAH_')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 334,339 ----
def testApplyPrefixToPath(self):
! expected = os.path.join('BLAH_tmp', 'BLAH_foo')
! actual = applyPrefixToPath(os.path.join('tmp', 'foo'), 'BLAH_')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 350,355 ****
def testApplyPrefixToPathRelative(self):
! expected = '../BLAH_tmp/BLAH_foo'
! actual = applyPrefixToPath('../tmp/foo', 'BLAH_')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 350,355 ----
def testApplyPrefixToPathRelative(self):
! expected = os.path.join(os.pardir, 'BLAH_tmp', 'BLAH_foo')
! actual = applyPrefixToPath(os.path.join(os.pardir, 'tmp', 'foo'), 'BLAH_')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 359,363 ****
def testRemovePrefix(self):
expected = 'foo'
! actual = removePrefix('/tmp/foo', '/tmp')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 359,363 ----
def testRemovePrefix(self):
expected = 'foo'
! actual = removePrefix(os.sep + os.path.join('tmp', 'foo'), os.sep + 'tmp')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 366,371 ****
def testRemovePrefixNotThere(self):
! expected = 'tmp/foo'
! actual = removePrefix('/tmp/foo', '/blah')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 366,371 ----
def testRemovePrefixNotThere(self):
! expected = os.path.join('tmp', 'foo')
! actual = removePrefix(os.path.join('tmp', 'foo'), os.sep + 'blah')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 375,379 ****
def testRemovePrefixEmptyPath(self):
expected = ''
! actual = removePrefix('', '/blah')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 375,379 ----
def testRemovePrefixEmptyPath(self):
expected = ''
! actual = removePrefix('', os.sep + 'blah')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 382,387 ****
def testRemovePrefixEmptyPrefix(self):
! expected = 'tmp/foo'
! actual = removePrefix('/tmp/foo', '')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 382,387 ----
def testRemovePrefixEmptyPrefix(self):
! expected = os.path.join('tmp', 'foo')
! actual = removePrefix(os.path.join('tmp', 'foo'), '')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 390,395 ****
def testCommonPrefix(self):
! expected = '/tmp'
! actual = commonPrefix('/tmp/foo', '/tmp/blah')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 390,396 ----
def testCommonPrefix(self):
! expected = os.sep + 'tmp'
! actual = commonPrefix(os.sep + os.path.join('tmp', 'foo'),
! os.sep + os.path.join('tmp', 'blah'))
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 399,403 ****
def testCommonPrefixNone(self):
expected = ''
! actual = commonPrefix('/var/tmp/foo', '/tmp/blah')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 400,406 ----
def testCommonPrefixNone(self):
expected = ''
! actual = commonPrefix(os.path.join('var', 'tmp', 'foo'),
! os.path.join('tmp', 'blah')
! )
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 407,416 ****
def testCommonPrefixEmptyPaths(self):
expected = ''
! actual = commonPrefix('', '/tmp/blah')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
% (expected, actual)
expected = ''
! actual = commonPrefix('/var/tmp/foo', '')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 410,419 ----
def testCommonPrefixEmptyPaths(self):
expected = ''
! actual = commonPrefix('', os.path.join('tmp', 'blah'))
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
% (expected, actual)
expected = ''
! actual = commonPrefix(os.path.join('var', 'tmp', 'foo'), '')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 419,424 ****
def testJoinWithCommonMiddle(self):
! expected = '/root/one/two/three/filename.txt'
! actual = joinWithCommonMiddle('/root/one', '/root/one/two', 'two/three/filename.txt')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 422,430 ----
def testJoinWithCommonMiddle(self):
! expected = os.path.join('root', 'one', 'two', 'three', 'filename.txt')
! actual = joinWithCommonMiddle(os.path.join('root', 'one'),
! os.path.join('root', 'one', 'two'),
! os.path.join('two', 'three', 'filename.txt')
! )
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 427,432 ****
def testJoinWithCommonMiddleNotCommon(self):
! expected = '/root/one/four/two/three/filename.txt'
! actual = joinWithCommonMiddle('/root/one/five', '/root/one/four', 'two/three/filename.txt')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 433,441 ----
def testJoinWithCommonMiddleNotCommon(self):
! expected = os.path.join('root', 'one', 'four', 'two', 'three', 'filename.txt')
! actual = joinWithCommonMiddle(os.path.join('root', 'one', 'five'),
! os.path.join('root', 'one', 'four'),
! os.path.join('two', 'three', 'filename.txt')
! )
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 435,440 ****
def testJoinWithCommonMiddleEmptyPrefix(self):
! expected = '/root/one/four/two/three/filename.txt'
! actual = joinWithCommonMiddle('', '/root/one/four', 'two/three/filename.txt')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 444,452 ----
def testJoinWithCommonMiddleEmptyPrefix(self):
! expected = os.path.join('root', 'one', 'four', 'two', 'three', 'filename.txt')
! actual = joinWithCommonMiddle('',
! os.path.join('root', 'one', 'four'),
! os.path.join('two', 'three', 'filename.txt')
! )
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 443,448 ****
def testJoinWithCommonMiddleEmptyPath1(self):
! expected = 'two/three/filename.txt'
! actual = joinWithCommonMiddle('/root/one/five', '', 'two/three/filename.txt')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 455,463 ----
def testJoinWithCommonMiddleEmptyPath1(self):
! expected = os.path.join('two', 'three', 'filename.txt')
! actual = joinWithCommonMiddle(os.path.join('root', 'one', 'five'),
! '',
! os.path.join('two', 'three', 'filename.txt')
! )
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 452,457 ****
def testJoinWithCommonMiddleEmptyPath2(self):
! expected = '/root/one/two/'
! actual = joinWithCommonMiddle('/root/one', '/root/one/two', '')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 467,474 ----
def testJoinWithCommonMiddleEmptyPath2(self):
! expected = os.path.join('root', 'one', 'two') + os.sep
! actual = joinWithCommonMiddle(os.path.join('root', 'one'),
! os.path.join('root', 'one', 'two'),
! '')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 469,473 ****
def testComputeRelativeHTMLLinkUpOneDirectory(self):
expected = '../my.gif'
! actual = computeRelativeHTMLLink('index.html', '../my.gif', '/tmp/base/dir')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 486,493 ----
def testComputeRelativeHTMLLinkUpOneDirectory(self):
expected = '../my.gif'
! actual = computeRelativeHTMLLink('index.html',
! os.path.join(os.pardir, 'my.gif'),
! os.path.join('tmp', 'base', 'dir')
! )
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 477,484 ****
def testComputeRelativeHTMLLinkInParentDirectory(self):
! expected = '../my.gif'
! actual = computeRelativeHTMLLink('/tmp/base/dir/index.html',
! '/tmp/base/my.gif',
! '/tmp/base')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 497,506 ----
def testComputeRelativeHTMLLinkInParentDirectory(self):
! expected = os.path.join(os.pardir, 'my.gif')
! actual = computeRelativeHTMLLink(
! os.path.join('tmp', 'base', 'dir', 'index.html'),
! os.path.join('tmp', 'base', 'my.gif'),
! os.path.join('tmp', 'base')
! )
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 488,492 ****
def testRemoveRelativePrefixCurrentDir(self):
expected = 'foo'
! actual = removeRelativePrefix('./foo')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 510,514 ----
def testRemoveRelativePrefixCurrentDir(self):
expected = 'foo'
! actual = removeRelativePrefix(os.path.join(os.curdir, 'foo'))
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
***************
*** 496,500 ****
def testRemoveRelativePrefixParentDir(self):
expected = 'foo'
! actual = removeRelativePrefix('../foo')
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
--- 518,522 ----
def testRemoveRelativePrefixParentDir(self):
expected = 'foo'
! actual = removeRelativePrefix(os.path.join(os.pardir, 'foo'))
assert actual == expected, \
'Path modification failed.\n\tExpected "%s",\n\tgot "%s"' \
|