Beispiel #1
0
class testRegexes :
    """
    Test Regexes Class
    """
    def setUp(self) :
        self.Tools = Tools()
        self.Tools.createRootDir()
        self.Tools.createBackendFiles()
        
        self.regex = Regexes()
        
    def tearDown(self):
        self.Tools.removeTempFiles()
        
    def testRemoveTags(self):
        
        assert self.regex.removeTags( '<h1>Text</h1>' ) == 'Text'
        #assert self.regex.removeTags( '<h1><h1>Text</h1></h1>' ) == 'Text'
        #assert self.regex.removeTags( '<h1>Text</h1></h1>' ) == 'Text'
        
    def testExtractAirDate(self):
        
        self.regex.extractAirDate( '<strong>6 November 2008</strong>' ) == ('6 November 2008',)
        
    def testExtractEpSeTitle(self):
        
        assert self.regex.extractEpSeTitle( '<h3>Season 00051, Episode 010: <a href="/title/t0987tsa/">Title</a></h3>' ) == ('51', '10', 'Title')
        assert self.regex.extractEpSeTitle( '<h3>Season 9, Episode 201: <a href="/title/t/">T80932sdf/[]}}]</a></h3>' ) == ('9', '201', 'T80932sdf/[]}}]')
        assert self.regex.extractEpSeTitle( '<h3>Season 12, Episode 00: <a href="/title/098sdft8/">) s{ }350dfklj</a></h3>' ) == ('12', '0', ') s{ }350dfklj')
        assert self.regex.extractEpSeTitle( '<h3>Season 001000050, Episode 010: <a href="/title/098sdft8/"></a></h3>' ) == ('1000050', '10', None)
Beispiel #2
0
 def setUp(self) :
     self.Tools = Tools()
     self.Tools.createRootDir()
     self.Tools.createBackendFiles()
     
     self.regex = Regexes()