Back to index

plone3  3.1.7
Public Member Functions
CMFDiffTool.tests.testListDiff.TestListDiff Class Reference

List of all members.

Public Member Functions

def testInterface
def testAttributeSame
def testAttributeDiff
def testGetLineDiffsSame
def testGetLineDiffsDifferent
def testSameText
def testDiffText

Detailed Description

Test the ListDiff class

Definition at line 16 of file testListDiff.py.


Member Function Documentation

Test attribute with different value

Definition at line 30 of file testListDiff.py.

00030 
00031     def testAttributeDiff(self):
00032         """Test attribute with different value"""
00033         a = A()
00034         b = B()
00035         diff = ListDiff(a, b, 'attribute')
00036         self.failIf(diff.same)

Test attribute with same value

Definition at line 24 of file testListDiff.py.

00024 
00025     def testAttributeSame(self):
00026         """Test attribute with same value"""
00027         a = A()
00028         diff = ListDiff(a, a, 'attribute')
00029         self.failUnless(diff.same)

Test text diff output with no diff

Definition at line 59 of file testListDiff.py.

00059 
00060     def testDiffText(self):
00061         """Test text diff output with no diff"""
00062         a = A()
00063         b = B()
00064         expected = "  1\n  2\n  3\n+ 4"
00065         diff = ListDiff(a, b, 'attribute')
00066         self.assertEqual(diff.ndiff(), expected)
00067 
00068         # FIXME: need tests for other kinds of diffs
00069 

test getLineDiffs() method with different value

Definition at line 44 of file testListDiff.py.

00044 
00045     def testGetLineDiffsDifferent(self):
00046         """test getLineDiffs() method with different value"""
00047         a = A()
00048         b = B()
00049         diff = ListDiff(a, b, 'attribute')
00050         expected = [('equal', 0, 3, 0, 3) ,('insert', 3, 3, 3, 4)]
00051         self.assertEqual(diff.getLineDiffs(), expected)
        
test getLineDiffs() method with same value

Definition at line 37 of file testListDiff.py.

00037 
00038     def testGetLineDiffsSame(self):
00039         """test getLineDiffs() method with same value"""
00040         a = A()
00041         diff = ListDiff(a, a, 'attribute')
00042         expected = [('equal', 0, 3, 0, 3)]
00043         self.assertEqual(diff.getLineDiffs(), expected)

Ensure that tool instances implement the portal_diff interface

Definition at line 19 of file testListDiff.py.

00019 
00020     def testInterface(self):
00021         """Ensure that tool instances implement the portal_diff interface"""
00022         from Products.CMFDiffTool.interfaces.portal_diff import IDifference
00023         self.failUnless(IDifference.isImplementedByInstancesOf(ListDiff))
    
Test text diff output with no diff

Definition at line 52 of file testListDiff.py.

00052 
00053     def testSameText(self):
00054         """Test text diff output with no diff"""
00055         a = A()
00056         diff = ListDiff(a, a, 'attribute')
00057         expected = "  1\n  2\n  3"
00058         self.assertEqual(diff.ndiff(), expected)


The documentation for this class was generated from the following file: