Error while running "pytest -m projection"

pytest -m projection
============================= test session starts =============================
platform win32 – Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0
rootdir: C:\MongoDB Study\M220P\mflix-python, inifile:
plugins: remotedata-0.2.1, openfiles-0.3.0, flask-0.10.0, doctestplus-0.1.3, arraydiff-0.2
collected 35 items / 33 deselected

tests\ FF [100%]

================================== FAILURES ===================================
________________________ test_basic_country_search_db _________________________

client = <FlaskClient <Flask ‘mflix.factory’>>

def test_basic_country_search_db(client):
    countries = ['Kosovo']
    result = get_movies_by_country(countries)
  assert len(result) == 2

E TypeError: object of type ‘TypeError’ has no len()

tests\ TypeError
---------------------------- Captured stdout call -----------------------------
unhashable type: ‘list’
_____________________ test_basic_country_search_shape_db ______________________

client = <FlaskClient <Flask ‘mflix.factory’>>

def test_basic_country_search_shape_db(client):
    countries = ['Russia', 'Japan']
    result = get_movies_by_country(countries)
  assert len(result) == 2421

E TypeError: object of type ‘TypeError’ has no len()

tests\ TypeError
=================== 2 failed, 33 deselected in 1.51 seconds ===================


I think the problem is located in line 82 of your file. Your code is returning an exception in line 79 and tests fail. I suppose your query statement in find function is invalid.

It’s the clue I can give you. I hope it helps you.


Thanks for help @galindale… I’ll try to fix it there…

Did it work? For you?

@vishal-das Not yet…
Are you facing similar issue.

Yeah man! I tried all my Python logics to pass this but no use of any


I tried the same query in Mongo Compass, its working fine … giving the desired result
But still checking…

Hi again,

Try to execute your find query inside Mongo shell in your computer.

I copied my find query replacing the countries Python variable with a sample array like [“Japan”] in Mongo shell and I received some documents as a response.