Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6081537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:11:13+00:00 2026-05-23T11:11:13+00:00

I encountered a problem with the availability of objects created within the decorator, and

  • 0

I encountered a problem with the availability of objects created within the decorator, and needed in the test_case method. My code presenting below:

def execute_results_navigation(test_case):
    def wrapper(self,*args,**kwargs):
        result=Result()
        pagination=Pagination()
        results_page_index=1
        while results_page_index<=pagination.get_pages_number():

            for results_object_index in range(results.get_objects_number_per_single_page()):
                test_case(self,*args,**kwargs)

                pagination.set_active_page_number(results_page_index)
            results_page_index+=1

    return wrapper

In place of test_case method is “injected” the following code (everything takes place using predefined decorator):

@execute_results_navigation
def test_check_availability_of_search_results(self):
    """
    test case 2.22
    """
    offer=Offer()

    result.select_hotel(results_caller["button"],results_object_index)
    offer_price=offer.get_offer_object_details().price
    offer.verify_offer_availability(offer_price)
    offer.back_to_search_results()

test_case method has no access to result,pagination objects and results_object_index variable. All objects have been initialized when calling the decorator. Maybe I’m doing something wrong with this method, but I thought that these instances exist within the wrapper method and access to them should not cause problems.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:11:13+00:00Added an answer on May 23, 2026 at 11:11 am

    You won’t be able to access local variables defined in wrapper within test_case.

    Looks like test_check_availability_of_search_results is an instance method, so one way to solve your problem is to assign those variables to attributes of ‘self’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I encountered a problem when running some old code that was handed down to
I encountered this problem while solving a practice test Consider the following code written
I encountered this problem while solving a practice test Consider this C code to
I encountered that problem already a few times: I have a dynamically created textfield,
I've encountered a problem while writing code in Delphi. Namely I can't get acces
Encountered such problem: I ve created a new blank project of ASP.NET MVC site.
I have encountered strange problem. I have created simple Flash text field control and
I encountered a problem with getPath() recently. my code looks something like this: File
just encountered a problem at dict type subclassing. I did override __iter__ method and
We encountered a problem with using Subversion on Windows. A developer committed a file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.