2009-10-23 14:35:51 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Created By: Virgil Dupras
|
|
|
|
# Created On: 2009-10-23
|
2013-04-28 14:35:51 +00:00
|
|
|
# Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
|
2009-10-23 14:35:51 +00:00
|
|
|
#
|
2010-09-30 10:17:41 +00:00
|
|
|
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
2009-10-23 14:35:51 +00:00
|
|
|
# which should be included with this package. The terms are also available at
|
2010-09-30 10:17:41 +00:00
|
|
|
# http://www.hardcoded.net/licenses/bsd_license
|
2009-10-23 14:35:51 +00:00
|
|
|
|
2011-01-11 10:59:53 +00:00
|
|
|
from hscommon.path import Path
|
2009-10-23 14:35:51 +00:00
|
|
|
|
2009-12-30 10:37:57 +00:00
|
|
|
from core.engine import getwords
|
2012-05-29 21:05:39 +00:00
|
|
|
from core.tests.scanner_test import NamedObject, no
|
2009-10-23 14:35:51 +00:00
|
|
|
from ..scanner import *
|
|
|
|
|
2011-01-05 10:11:21 +00:00
|
|
|
def pytest_funcarg__fake_fileexists(request):
|
|
|
|
# This is a hack to avoid invalidating all previous tests since the scanner started to test
|
|
|
|
# for file existence before doing the match grouping.
|
|
|
|
monkeypatch = request.getfuncargvalue('monkeypatch')
|
2013-04-28 14:46:36 +00:00
|
|
|
monkeypatch.setattr(Path, 'exists', lambda _: True)
|
2011-01-05 10:11:21 +00:00
|
|
|
|
|
|
|
def test_priorize_me(fake_fileexists):
|
|
|
|
# in ScannerME, bitrate goes first (right after is_ref) in priorization
|
|
|
|
s = ScannerME()
|
2012-05-29 21:05:39 +00:00
|
|
|
o1, o2 = no('foo', path='p1'), no('foo', path='p2')
|
2011-01-05 10:11:21 +00:00
|
|
|
o1.bitrate = 1
|
|
|
|
o2.bitrate = 2
|
2012-02-21 16:14:12 +00:00
|
|
|
[group] = s.get_dupe_groups([o1, o2])
|
2011-01-05 10:11:21 +00:00
|
|
|
assert group.ref is o2
|
|
|
|
|