def test_quality_as_ep(self): """SeriesParser: test that qualities are not picked as ep""" from flexget.utils import qualities for quality in qualities.all_components(): s = SeriesParser(name='FooBar', identified_by='ep') s.data = 'FooBar %s XviD-FlexGet' % quality.name assert_raises(ParseWarning, s.parse)
def test_quality_as_ep(self): """SeriesParser: test that qualities are not picked as ep""" from flexget.utils import qualities for quality in qualities.all_components(): s = SeriesParser(name='FooBar') s.data = 'FooBar %s XviD-FlexGet' % quality.name assert_raises(ParseWarning, s.parse)
def test_ep_as_quality(self, parse): """SeriesParser: test that eps are not picked as qualities""" from flexget.utils import qualities for quality1 in qualities.all_components(): # Attempt to create an episode number out of quality mock_ep1 = ''.join(list(filter(str.isdigit, quality1.name))) if not mock_ep1: continue for quality2 in qualities.all_components(): mock_ep2 = ''.join(list(filter(str.isdigit, quality2.name))) if not mock_ep2: continue # 720i, 1080i, etc. are failing because # e.g the 720 in 720i can always be taken to mean 720p, # which is a higher priority quality. # Moreover, 1080 as an ep number is always failing because # sequence regexps support at most 3 digits at the moment. # Luckily, all of these cases are discarded by the following, # which also discards the failing cases when episode number # (e.g. 720) is greater or equal than quality number (e.g. 480p). # There's nothing that can be done with those failing cases with the # current # "grab leftmost occurrence of highest quality-like thing" algorithm. if int(mock_ep1) >= int(mock_ep2) or int(mock_ep2) > 999: continue s = parse('FooBar - %s %s-FlexGet' % (mock_ep1, quality2.name), name='FooBar') assert s.episode == int( mock_ep1), "confused episode %s with quality %s" % ( mock_ep1, quality2.name, ) # Also test with reversed relative order of episode and quality s = parse('[%s] FooBar - %s [FlexGet]' % (quality2.name, mock_ep1), name='FooBar') assert s.episode == int( mock_ep1), "confused episode %s with quality %s" % ( mock_ep1, quality2.name, )
def test_ep_as_quality(self, parse): """SeriesParser: test that eps are not picked as qualities""" from flexget.utils import qualities for quality1 in qualities.all_components(): # Attempt to create an episode number out of quality mock_ep1 = ''.join(list(filter(str.isdigit, quality1.name))) if not mock_ep1: continue for quality2 in qualities.all_components(): mock_ep2 = ''.join(list(filter(str.isdigit, quality2.name))) if not mock_ep2: continue # 720i, 1080i, etc. are failing because # e.g the 720 in 720i can always be taken to mean 720p, # which is a higher priority quality. # Moreover, 1080 as an ep number is always failing because # sequence regexps support at most 3 digits at the moment. # Luckily, all of these cases are discarded by the following, # which also discards the failing cases when episode number # (e.g. 720) is greater or equal than quality number (e.g. 480p). # There's nothing that can be done with those failing cases with the # current # "grab leftmost occurrence of highest quality-like thing" algorithm. if int(mock_ep1) >= int(mock_ep2) or int(mock_ep2) > 999: continue s = parse('FooBar - %s %s-FlexGet' % (mock_ep1, quality2.name), name='FooBar') assert s.episode == int(mock_ep1), "confused episode %s with quality %s" % ( mock_ep1, quality2.name, ) # Also test with reversed relative order of episode and quality s = parse('[%s] FooBar - %s [FlexGet]' % (quality2.name, mock_ep1), name='FooBar') assert s.episode == int(mock_ep1), "confused episode %s with quality %s" % ( mock_ep1, quality2.name, )
def test_quality_as_ep(self, parse): """SeriesParser: test that qualities are not picked as ep""" from flexget.utils import qualities for quality in qualities.all_components(): parse('FooBar %s XviD-FlexGet' % quality.name, name='FooBar')