nighl
This commit is contained in:
92
bin/ffx/test/basename_combinator_2.py
Normal file
92
bin/ffx/test/basename_combinator_2.py
Normal file
@@ -0,0 +1,92 @@
|
||||
import os, sys, importlib, glob, inspect, itertools
|
||||
|
||||
from ffx.track_type import TrackType
|
||||
|
||||
from ffx.track_descriptor import TrackDescriptor
|
||||
from ffx.media_descriptor import MediaDescriptor
|
||||
|
||||
from .basename_combinator import BasenameCombinator
|
||||
|
||||
from .indicator_combinator import IndicatorCombinator
|
||||
from .label_combinator import LabelCombinator
|
||||
|
||||
class BasenameCombinator2(BasenameCombinator):
|
||||
|
||||
VARIANT = 'B2'
|
||||
|
||||
# def __init__(self, SubCombinators: dict = {}, context = None):
|
||||
def __init__(self, context = None):
|
||||
|
||||
self._context = context
|
||||
self._logger = context['logger']
|
||||
self._reportLogger = context['report_logger']
|
||||
|
||||
def getVariant(self):
|
||||
return BasenameCombinator2.VARIANT
|
||||
|
||||
def getPayload(self):
|
||||
return {'To': 'Fanz',
|
||||
'Yolo': 'Holo'}
|
||||
|
||||
def assertFunc(self, mediaDescriptor: MediaDescriptor):
|
||||
mediaTags = mediaDescriptor.getTags()
|
||||
|
||||
assert 'To' in mediaTags.keys(), "'To' not in media tag keys"
|
||||
assert mediaTags.keys()['To'] == 'Fanz', "Media tag value not 'Fanz' for key 'To'"
|
||||
assert 'Yolo' in mediaTags.keys(), "'Yolo' not in media tag keys"
|
||||
assert mediaTags.keys()['Yolo'] == 'Holo', "Media tag value not 'Holo' for key 'Yolo'"
|
||||
|
||||
def shouldFail(self):
|
||||
return False
|
||||
|
||||
def getYield(self):
|
||||
|
||||
for L in LabelCombinator.getAllClassReferences():
|
||||
for I in IndicatorCombinator.getAllClassReferences():
|
||||
|
||||
for TC2_A in TrackTagCombinator2.getAllClassReferences():
|
||||
for DC3_S in DispositionCombinator3.getAllClassReferences():
|
||||
for TC3_S in TrackTagCombinator3.getAllClassReferences():
|
||||
for J in JellyfinCombinator.getAllClassReferences():
|
||||
|
||||
j = J(self._context)
|
||||
self._context['use_jellyfin'] = j.getPayload()
|
||||
|
||||
dc2a = DC2_A(self._context)
|
||||
tc2a = TC2_A(self._context)
|
||||
dc3s = DC3_S(self._context)
|
||||
tc3s = TC3_S(self._context)
|
||||
mtc = MTC(self._context)
|
||||
|
||||
yieldObj = {}
|
||||
|
||||
yieldObj['identifier'] = self.getIdentifier()
|
||||
yieldObj['variants'] = [self.getVariant(),
|
||||
f"A:{dc2a.getVariant()}",
|
||||
f"A:{tc2a.getVariant()}",
|
||||
f"S:{dc3s.getVariant()}",
|
||||
f"S:{tc3s.getVariant()}",
|
||||
mtc.getVariant(),
|
||||
j.getVariant()]
|
||||
|
||||
yieldObj['payload'] = self.getPayload(dc2a.getPayload(), tc2a.getPayload(), dc3s.getPayload(), tc3s.getPayload())
|
||||
|
||||
yieldObj['assertSelectors'] = ['M', 'AD', 'AT', 'SD', 'ST', 'MT', 'J']
|
||||
|
||||
yieldObj['assertFuncs'] = [self.assertFunc,
|
||||
dc2a.assertFunc,
|
||||
tc2a.assertFunc,
|
||||
dc3s.assertFunc,
|
||||
tc3s.assertFunc,
|
||||
mtc.assertFunc,
|
||||
j.assertFunc]
|
||||
|
||||
yieldObj['shouldFail'] = (self.shouldFail()
|
||||
| dc2a.shouldFail()
|
||||
| tc2a.shouldFail()
|
||||
| dc3s.shouldFail()
|
||||
| tc3s.shouldFail()
|
||||
| mtc.shouldFail()
|
||||
| j.shouldFail())
|
||||
|
||||
yield yieldObj
|
||||
Reference in New Issue
Block a user