@pytest.mark.django_db
def test_get_path_obj(rf, po_directory, default, tp0):
 language_code = tp0.language.code
 project_code = tp0.project.code
 language_code_fake = 'faf'
 project_code_fake = 'fake-tutorial'
 request = rf.get('/')
 request.user = default
 func = get_path_obj((lambda x, y: (x, y)))
 func(request, project_code=project_code)
 assert isinstance(request.ctx_obj, Project)
 with pytest.raises(Http404):
  func(request, project_code=project_code_fake)
 func(request, language_code=language_code)
 assert isinstance(request.ctx_obj, Language)
 with pytest.raises(Http404):
  func(request, language_code=language_code_fake)
 func(request, language_code=language_code, project_code=project_code)
 assert isinstance(request.ctx_obj, TranslationProject)
 with pytest.raises(Http404):
  func(request, language_code=language_code_fake, project_code=project_code)

@ pytest . mark . django_db def test_get_path_obj ( rf , po_directory , default , tp0 ) : language_code = tp0 . language . code project_code = tp0 . project . code language_code_fake = 'faf' project_code_fake = 'fake-tutorial' request = rf . get ( '/' ) request . user = default func = get_path_obj ( ( lambda x , y : ( x , y ) ) ) func ( request , project_code = project_code ) assert isinstance ( request . ctx_obj , Project ) with pytest . raises ( Http404 ) : func ( request , project_code = project_code_fake ) func ( request , language_code = language_code ) assert isinstance ( request . ctx_obj , Language ) with pytest . raises ( Http404 ) : func ( request , language_code = language_code_fake ) func ( request , language_code = language_code , project_code = project_code ) assert isinstance ( request . ctx_obj , TranslationProject ) with pytest . raises ( Http404 ) : func ( request , language_code = language_code_fake , project_code = project_code )
ensure the correct path object is retrieved .