Skip to content

Commit

Permalink
DOC-3787 applied black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-stark-redis committed May 15, 2024
1 parent 5b11111 commit e6a3e1c
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions doctests/dt_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,25 +268,23 @@
# REMOVE_START
assert res8 == [
{
'id': 'bike:2',
'model': 'Quaoar',
'description': "Redesigned for the 2020 model year, this bike impressed "
"id": "bike:2",
"model": "Quaoar",
"description": "Redesigned for the 2020 model year, this bike impressed "
"our testers and is the best all-around trail bike we've ever tested. "
"The Shimano gear system effectively does away with an external cassette, "
"so is super low maintenance in terms of wear and tear. All in all it's "
"an impressive package for the price, making it very competitive.",
'price': 2072,
'specs': {'material': 'aluminium', 'weight': 7.9},
'colors': ['black', 'white']
"price": 2072,
"specs": {"material": "aluminium", "weight": 7.9},
"colors": ["black", "white"],
}
]
# REMOVE_END

# STEP_START filter2
# names of bikes made from an alloy
res9 = r.json().get(
"bikes:inventory", "$..[?(@.specs.material == 'alloy')].model"
)
res9 = r.json().get("bikes:inventory", "$..[?(@.specs.material == 'alloy')].model")
print(res9) # >>> ['Weywot', 'Mimas']
# STEP_END

Expand All @@ -295,9 +293,7 @@
# REMOVE_END

# STEP_START filter3
res10 = r.json().get(
"bikes:inventory", "$..[?(@.specs.material =~ '(?i)al')].model"
)
res10 = r.json().get("bikes:inventory", "$..[?(@.specs.material =~ '(?i)al')].model")
print(res10) # >>> ['Quaoar', 'Weywot', 'Salacia', 'Mimas']
# STEP_END

Expand All @@ -318,9 +314,9 @@

res14 = r.json().get(
"bikes:inventory",
"$.inventory.mountain_bikes[?(@.specs.material =~ @.regex_pat)].model"
"$.inventory.mountain_bikes[?(@.specs.material =~ @.regex_pat)].model",
)
print(res14) # >>> ['Quaoar', 'Weywot']
print(res14) # >>> ['Quaoar', 'Weywot']
# STEP_END

# REMOVE_START
Expand All @@ -345,11 +341,9 @@
# REMOVE_END

# STEP_START update_filters1
res18 = r.json().set(
"bikes:inventory", "$.inventory.*[?(@.price<2000)].price", 1500
)
res18 = r.json().set("bikes:inventory", "$.inventory.*[?(@.price<2000)].price", 1500)
res19 = r.json().get("bikes:inventory", "$..price")
print(res19) # >>> [1500, 2072, 3264, 1500, 3941]
print(res19) # >>> [1500, 2072, 3264, 1500, 3941]
# STEP_END

# REMOVE_START
Expand Down

0 comments on commit e6a3e1c

Please sign in to comment.