Skip to content

Commit

Permalink
Update test_rest_api_spec.py
Browse files Browse the repository at this point in the history
  • Loading branch information
saimedhi authored Mar 14, 2024
1 parent 11a658a commit 94d20e8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test_opensearchpy/test_server/test_rest_api_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ def run_length(self, action: Any) -> None:

def run_match(self, action: Any) -> None:
for path, expected in action.items():
print("expected @before", expected )
print("path @before ", path)
value = self._lookup(path)
expected = self._resolve(expected)
print("expected before", expected )
Expand Down Expand Up @@ -440,9 +442,12 @@ def _resolve(self, value: Any) -> Any:
return value

def _lookup(self, path: str) -> Any:
print("lookup printed path",path)
# fetch the possibly nested value from last_response
value: Any = self.last_response
print("lookup printed value1",value)
if path == "$body":
print("lookup printed value2",value)
return value
path = path.replace(r"\.", "\1")
step: Any
Expand All @@ -461,17 +466,21 @@ def _lookup(self, path: str) -> Any:
assert isinstance(value, list)
assert len(value) > step
elif step == "_arbitrary_key_":
print("lookup printed value3",list(value.keys())[0])
return list(value.keys())[0]
else:
assert step in value
value = value[step]
print("lookup printed value4",value)
return value

def _feature_enabled(self, name: str) -> Any:
return False

def _assert_match_equals(self, a: Any, b: Any) -> None:
# Handle for large floating points with 'E'
print("_assert_match_equals a", a)
print("_assert_match_equals b", b)
if isinstance(b, string_types) and isinstance(a, float) and "e" in repr(a):
a = repr(a).replace("e+", "E")

Expand Down

0 comments on commit 94d20e8

Please sign in to comment.