Your first and second list comprehension are not identical:
test = [i for i in test if 'A1' in masterList]
is not the same as
test2 = [i for i in row if 'A1' in i]
For one, the ONLY thing the first test checks is to see if 'A1' is in masterList, you're not actually iteratively checking anything.
I can't explain why/what you should be getting because it's not clear from your question what is contained in test
initially, but the fact that you're checking to see if 'A1' in i
in one list comp and if 'A1' in masterList
in the other is probably the source of the discrepancy.