maggienj / ActiveData

Provide high speed filtering and aggregation over data
Mozilla Public License 2.0
0 stars 0 forks source link

tests/__init__.py - subtest wrap #59

Closed maggienj closed 7 years ago

maggienj commented 7 years ago

tests/init.py

line#147

   def execute_tests(self, subtest, tjson=True):
        subtest = wrap(subtest)
        subtest.name = extract_stack()[1]['method']

        self.fill_container(subtest, tjson=tjson)
        self.send_queries(subtest)

    def fill_container(self, subtest, tjson=True):
        """
        RETURN SETTINGS THAT CAN BE USED TO POINT TO THE INDEX THAT'S FILLED
        """
        subtest = wrap(subtest)

in the execution pattern, we see that this line can be removed in fill_container.... subtest = wrap(subtest) line#158

Because, the function execute_tests has already completed wrapping subtest. So, line#158 could be removed.... possibly...

klahnakoski commented 7 years ago

What are the call sites for fill_container? Do they all wrap?

maggienj commented 7 years ago

not sure what that means...

based on the flow this is what i see here....

it appears to be a redundant wrapin fill_container and in send_queries.... because, execute_tests has already wrapped the input once and then passing it to "fill_container" function and "send_queries" function.
That means... fill_container and send_queries need not wrap again.

subtest variable holds the input for the test. and wrapping this once should be sufficient as it is being passed from the caller to the other utility functions such as fill_container and send_queries.

  def send_queries(self, subtest):
        subtest = wrap(subtest)
klahnakoski commented 7 years ago

The wrap in fill_container is NOT redundant. Please find all instances of fill_container to see the many points the method is called. Some callers require wrapping.

Do not waste your time with this optimization. It is too small to be noticed, and it is for running the tests, it will not make the product faster.