Ticket #5127: remove-lore-tree-deprecated-a.patch

File remove-lore-tree-deprecated-a.patch, 2.5 KB (added by facundobatista, 4 years ago)
  • twisted/lore/test/test_lore.py

    === modified file 'twisted/lore/test/test_lore.py'
     
    11971197        """ 
    11981198        processor = lore.getProcessor("lore", "html", options) 
    11991199        self.assertNotIdentical(processor, None) 
    1200  
    1201  
    1202  
    1203 class DeprecationTests(unittest.TestCase): 
    1204     """ 
    1205     Tests for deprecated APIs in L{twisted.lore.tree}. 
    1206     """ 
    1207     def test_comparePosition(self): 
    1208         """ 
    1209         L{tree.comparePosition} is deprecated. 
    1210         """ 
    1211         from twisted.web.microdom import parseString 
    1212         element = parseString('<foo/>').documentElement 
    1213         self.assertEqual( 
    1214             self.callDeprecated( 
    1215                 Version('Twisted', 9, 0, 0), 
    1216                 tree.comparePosition, element, element), 
    1217             0) 
    1218  
    1219  
    1220     def test_compareMarkPos(self): 
    1221         """ 
    1222         L{tree.compareMarkPos} is deprecated. 
    1223         """ 
    1224         self.assertEqual( 
    1225             self.callDeprecated( 
    1226                 Version('Twisted', 9, 0, 0), 
    1227                 tree.compareMarkPos, [0, 1], [1, 2]), 
    1228             -1) 
  • twisted/lore/tree.py

    === modified file 'twisted/lore/tree.py'
     
    1212 
    1313from twisted.python import htmlizer, text 
    1414from twisted.python.filepath import FilePath 
    15 from twisted.python.deprecate import deprecated 
    1615from twisted.python.versions import Version 
    1716from twisted.web import domhelpers 
    1817import process, latex, indexer, numberer, htmlbook 
     
    471470 
    472471 
    473472 
    474 def compareMarkPos(a, b): 
    475     """ 
    476     Perform in every way identically to L{cmp} for valid inputs. 
    477     """ 
    478     linecmp = cmp(a[0], b[0]) 
    479     if linecmp: 
    480         return linecmp 
    481     return cmp(a[1], b[1]) 
    482 compareMarkPos = deprecated(Version('Twisted', 9, 0, 0))(compareMarkPos) 
    483  
    484  
    485  
    486 def comparePosition(firstElement, secondElement): 
    487     """ 
    488     Compare the two elements given by their position in the document or 
    489     documents they were parsed from. 
    490  
    491     @type firstElement: C{dom.Element} 
    492     @type secondElement: C{dom.Element} 
    493  
    494     @return: C{-1}, C{0}, or C{1}, with the same meanings as the return value 
    495     of L{cmp}. 
    496     """ 
    497     return cmp(firstElement._markpos, secondElement._markpos) 
    498 comparePosition = deprecated(Version('Twisted', 9, 0, 0))(comparePosition) 
    499  
    500  
    501  
    502473def findNodeJustBefore(target, nodes): 
    503474    """ 
    504475    Find the last Element which is a sibling of C{target} and is in C{nodes}.