Skip to content

Commit

Permalink
Convert filtered iterable in tests to lists for extraction, re:#608
Browse files Browse the repository at this point in the history
  • Loading branch information
machawk1 committed Jun 1, 2019
1 parent cd6fa76 commit 5f30101
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tests/test_memento.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_acceptdatetime_status(warc, lookup, acceptdatetime, status):
def test_mementoRelations_one():
relsForURIMs = getRelsFromURIMSinWARC('1memento.warc')

relsForURIMs = filter(lambda k: 'memento' in k, relsForURIMs[0])
relsForURIMs = list(filter(lambda k: 'memento' in k, relsForURIMs[0]))
m1_m1 = relsForURIMs[0].split(' ')

onlyOneMemento = len(relsForURIMs) == 1
Expand All @@ -98,8 +98,8 @@ def test_mementoRelations_two():
cond_firstPrevMemento = False
cond_lastMemento = False

relsForURIMs1of2 = filter(lambda k: 'memento' in k, relsForURIMs[0])
relsForURIMs2of2 = filter(lambda k: 'memento' in k, relsForURIMs[1])
relsForURIMs1of2 = list(filter(lambda k: 'memento' in k, relsForURIMs[0]))
relsForURIMs2of2 = list(filter(lambda k: 'memento' in k, relsForURIMs[1]))

# mX_mY = URI-M requested, Y-th URIM-M in header
m1_m1 = relsForURIMs1of2[0].split(' ')
Expand Down Expand Up @@ -132,9 +132,9 @@ def test_mementoRelations_three():
cond_m3m2_prevMemento = False
cond_m3m3_lastMemento = False

relsForURIMs1of3 = filter(lambda k: 'memento' in k, relsForURIMs[0])
relsForURIMs2of3 = filter(lambda k: 'memento' in k, relsForURIMs[1])
relsForURIMs3of3 = filter(lambda k: 'memento' in k, relsForURIMs[2])
relsForURIMs1of3 = list(filter(lambda k: 'memento' in k, relsForURIMs[0]))
relsForURIMs2of3 = list(filter(lambda k: 'memento' in k, relsForURIMs[1]))
relsForURIMs3of3 = list(filter(lambda k: 'memento' in k, relsForURIMs[2]))

# mX_mY = URI-M requested, Y-th URIM-M in header
m1_m1 = relsForURIMs1of3[0].split(' ')
Expand Down Expand Up @@ -189,10 +189,10 @@ def test_mementoRelations_four():
cond_m4m3_prevMemento = False
cond_m4m4_lastMemento = False

relsForURIMs1of4 = filter(lambda k: 'memento' in k, relsForURIMs[0])
relsForURIMs2of4 = filter(lambda k: 'memento' in k, relsForURIMs[1])
relsForURIMs3of4 = filter(lambda k: 'memento' in k, relsForURIMs[2])
relsForURIMs4of4 = filter(lambda k: 'memento' in k, relsForURIMs[3])
relsForURIMs1of4 = list(filter(lambda k: 'memento' in k, relsForURIMs[0]))
relsForURIMs2of4 = list(filter(lambda k: 'memento' in k, relsForURIMs[1]))
relsForURIMs3of4 = list(filter(lambda k: 'memento' in k, relsForURIMs[2]))
relsForURIMs4of4 = list(filter(lambda k: 'memento' in k, relsForURIMs[3]))

# mX_mY = URI-M requested, Y-th URIM-M in header
m1_m1 = relsForURIMs1of4[0].split(' ')
Expand Down Expand Up @@ -277,11 +277,11 @@ def test_mementoRelations_five():
cond_m5m4_prevMemento = False
cond_m5m5_lastMemento = False

relsForURIMs1of5 = filter(lambda k: 'memento' in k, relsForURIMs[0])
relsForURIMs2of5 = filter(lambda k: 'memento' in k, relsForURIMs[1])
relsForURIMs3of5 = filter(lambda k: 'memento' in k, relsForURIMs[2])
relsForURIMs4of5 = filter(lambda k: 'memento' in k, relsForURIMs[3])
relsForURIMs5of5 = filter(lambda k: 'memento' in k, relsForURIMs[4])
relsForURIMs1of5 = list(filter(lambda k: 'memento' in k, relsForURIMs[0]))
relsForURIMs2of5 = list(filter(lambda k: 'memento' in k, relsForURIMs[1]))
relsForURIMs3of5 = list(filter(lambda k: 'memento' in k, relsForURIMs[2]))
relsForURIMs4of5 = list(filter(lambda k: 'memento' in k, relsForURIMs[3]))
relsForURIMs5of5 = list(filter(lambda k: 'memento' in k, relsForURIMs[4]))

# mX_mY = URI-M requested, Y-th URIM-M in header
m1_m1 = relsForURIMs1of5[0].split(' ')
Expand Down

0 comments on commit 5f30101

Please sign in to comment.