Following is my corrected code
@pytest.mark.projection
def test_basic_country_search_shape_db(client):
countries = ['Russia', 'Japan']
result = get_movies_by_country(countries)
#in actual code it asserts to 2 which is wrong since the countries Russia and japan retruns
#2420 movies
assert len(result) == 2420
# we should only be returning the _id and title fields
encountered_keys = {}
for movie in result:
for k in movie:
encountered_keys[k] = encountered_keys.get(k, 0) + 1
#In actual code it asserts to 2420 but as per instruction we are returing only two keys that
#are _id and title
assert len(list(encountered_keys.keys())) == 2
assert encountered_keys['_id'] == 2420
assert encountered_keys['title'] == 2420
Hope this helps friends