Example #1
0
 def __init__(self, oldErrors, newErrors):
     """
     @param oldErrors: errors to return when C{logText} is C{'old'}
     @param newErrors: errors to return when C{logText} is C{'new'}
     """
     LintStep.__init__(self)
     self.factory[1].clear()
     self.addFactoryArguments(oldErrors=oldErrors, newErrors=newErrors)
     self.oldErrors = oldErrors
     self.newErrors = newErrors
 def __init__(self, oldErrors, newErrors):
     """
     @param oldErrors: errors to return when C{logText} is C{'old'}
     @param newErrors: errors to return when C{logText} is C{'new'}
     """
     LintStep.__init__(self)
     self.factory[1].clear()
     self.addFactoryArguments(oldErrors=oldErrors, newErrors=newErrors)
     self.oldErrors = oldErrors
     self.newErrors = newErrors
 def test_emptyCurrent(self):
     """
     When given an C{current} dict that is empty, and a C{previous} dict,
     C{computeDifference} returns an empty dict.
     """
     previous = {'stuff': set(['a', 'b']), 'other': set(['x', 'y'])}
     diff = LintStep.computeDifference({}, previous)
     self.assertEqual(diff, {})
 def test_emptyPrevious(self):
     """
     When given an C{previous} dict that is empty, and a C{current} dict,
     C{computeDifference} returns a dictionary identical to C{current}.
     """
     current = {'stuff': set(['a', 'b']), 'other': set(['x', 'y'])}
     diff = LintStep.computeDifference(current, {})
     self.assertEqual(diff, current)
Example #5
0
 def test_emptyCurrent(self):
     """
     When given an C{current} dict that is empty, and a C{previous} dict,
     C{computeDifference} returns an empty dict.
     """
     previous = {'stuff': set(['a', 'b']), 'other': set(['x', 'y'])}
     diff = LintStep.computeDifference({}, previous)
     self.assertEqual(diff, {})
Example #6
0
 def test_emptyPrevious(self):
     """
     When given an C{previous} dict that is empty, and a C{current} dict,
     C{computeDifference} returns a dictionary identical to C{current}.
     """
     current = {'stuff': set(['a', 'b']), 'other': set(['x', 'y'])}
     diff = LintStep.computeDifference(current, {})
     self.assertEqual(diff, current)
 def test_sameKey(self):
     """
     When given a C{current} dict with a key whose contents is identical to C{previous},
     C{computeDifference} returns a dict without that key.
     """
     current = {'stuff': set(['a', 'b'])}
     previous = {'stuff': set(['a', 'b'])}
     diff = LintStep.computeDifference(current, previous)
     self.assertEqual(diff, {})
 def test_lessKeys(self):
     """
     When given a C{current} dict that is missing keys from C{previous},
     C{computeDifference} returns a dict with only the keys from C{current}.
     """
     current = {'stuff': set(['a', 'b'])}
     previous = {'stuff': set(['a']), 'other': set(['x', 'y'])}
     diff = LintStep.computeDifference(current, previous)
     self.assertEqual(diff, {'stuff': set(['b'])})
 def test_newKey(self):
     """
     When given a C{current} dict that has a key that isn't in C{previous} dict,
     C{computeDifference} returns a dict with everything in that key.
     """
     previous = {'stuff': set(['a', 'b'])}
     current = {'stuff': set(['a', 'b']), 'other': set(['x', 'y'])}
     diff = LintStep.computeDifference(current, previous)
     self.assertEqual(diff, {'other': set(['x', 'y'])})
Example #10
0
 def test_sameKey(self):
     """
     When given a C{current} dict with a key whose contents is identical to C{previous},
     C{computeDifference} returns a dict without that key.
     """
     current = {'stuff': set(['a', 'b'])}
     previous = {'stuff': set(['a', 'b'])}
     diff = LintStep.computeDifference(current, previous)
     self.assertEqual(diff, {})
Example #11
0
 def test_lessKeys(self):
     """
     When given a C{current} dict that is missing keys from C{previous},
     C{computeDifference} returns a dict with only the keys from C{current}.
     """
     current = {'stuff': set(['a', 'b'])}
     previous = {'stuff': set(['a']), 'other': set(['x', 'y'])}
     diff = LintStep.computeDifference(current, previous)
     self.assertEqual(diff, {'stuff': set(['b'])})
Example #12
0
 def test_newKey(self):
     """
     When given a C{current} dict that has a key that isn't in C{previous} dict,
     C{computeDifference} returns a dict with everything in that key.
     """
     previous = {'stuff': set(['a', 'b'])}
     current = {'stuff': set(['a', 'b']), 'other': set(['x', 'y'])}
     diff = LintStep.computeDifference(current, previous)
     self.assertEqual(diff, {'other': set(['x', 'y'])})