def _raw_api_side_effect_with_oversized_result(action, http_method, *args, **kwargs):
     query = kwargs["query"]
     offset = SMW.getOuterMostArgumentValueOfQuery("offset", query)
     n = int(int(offset)/RESULTS_PER_RESPONSE)+1
     res = self.result_of(n)
     res["query-continue-offset"] = RESULTS_PER_RESPONSE*n if n < MAX/RESULTS_PER_RESPONSE else 0
     return res
 def testArgumentValueExtraction(self):
     """ test if the argument value is correctly extracted from a given query"""
     # Test extraction
     expected = 12
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery(
             "limit", "[[Category:Person]]|limit=12"), expected,
         "Unable to extract the argument")
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery(
             "limit", "[[Category:Person]]|LIMIT=12"), expected,
         "Unable to extract the argument written as 'LIMIT' (Extraction should not be case sensitive)"
     )
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery(
             "limit", "[[Category:Person]]|LiMiT=12"), expected,
         "Unable to extract the argument written as 'LiMiT' (Extraction should not be case sensitive)"
     )
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery(
             "limit", "[[Category:Person]] | limit = 12"), expected,
         "Unable to extract the argument")
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery(
             "limit", "[[Category:Person]]|  limit=  12"), expected,
         "Unable to extract the argument")
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery(
             "limit", "[[Category:Person]]|limit   =12"), expected,
         "Unable to extract the argument")
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery("arg", "[[arg = 1]]|arg=12"),
         expected, "Incorrect extraction of arg")
     expected = 7
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery(
             "arg", "[[Category:Person]]|offset=12 | arg=7 | limit=5"),
         expected, "Unable to detect arg if other arguments are present")
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery(
             "arg", "[[Category:Person]]|arg=12 | arg=7 | limit=5"),
         expected, "Unable to detect last occurring argument arg correctly")
     # Test handling of invalid input
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery("arg",
                                              "[[Category:Person]]"), None,
         "Incorrect response to query without the argument. None should be returned"
     )
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery(None,
                                              "[[Category:Person]]"), None,
         "Incorrect response to None as argument. None should be returned")
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery("",
                                              "[[Category:Person]]"), None,
         "Incorrect response to argument being an empty string. None should be returned"
     )
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery("args", "[[args=1]]"), None,
         "Argument should not be detected inside the page selection condition."
     )
     self.assertEqual(SMW.getOuterMostArgumentValueOfQuery("arg", ""), None,
                      "Incorrect response for empty query")
     self.assertEqual(SMW.getOuterMostArgumentValueOfQuery("arg",
                                                           None), None,
                      "Missing error handling for None as query input")
     # Test if decimal numbers as value lead to None (Only integers should be extracted)
     self.assertEqual(
         SMW.getOuterMostArgumentValueOfQuery(
             "arg", "[[Category:Person]]|arg=12.5"), None,
         "Decimal number was extracted as correct value. Only integers should be extracted."
     )