Skip to content

Commit

Permalink
add formula integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
thrau committed Oct 29, 2024
1 parent 28cb650 commit c5b4f1c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/integration/test_basic_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Checkbox,
Database,
Date,
Formula,
MultiSelect,
Number,
Page,
Expand Down Expand Up @@ -46,6 +47,7 @@
},
},
"+1": {"people": {}},
"Rounded Price": {"formula": {"expression": 'round(prop("Price"))'}},
}


Expand All @@ -59,6 +61,7 @@ class FoodRecord(Page):
store_availability = MultiSelect("Store availability")
upvoted = People("+1")
description_plain = Text("Description")
rounded_price = Formula("Rounded Price")


@pytest.fixture()
Expand Down Expand Up @@ -97,6 +100,7 @@ def test_create_and_list_records(food_db):
assert records[0].food_group is None
assert records[0].store_availability == []
assert records[0].Price is None
assert records[0].rounded_price is None
assert records[0].last_ordered is None
assert records[0].description == []
assert records[0].description_plain == ""
Expand All @@ -106,6 +110,7 @@ def test_create_and_list_records(food_db):
assert records[1].food_group == "Fruit"
assert records[1].store_availability == ["Duc Loi Market", "Rainbow Grocery"]
assert records[1].Price == 123.45
assert records[1].rounded_price == 123
assert records[1].last_ordered == now
assert records[1].description_plain == "hot food record"
assert records[1].description[0].to_dict() == {
Expand Down Expand Up @@ -157,4 +162,5 @@ def test_create_to_dict(food_db):
"name": "My New Food Record",
"store_availability": ["Duc Loi Market", "Rainbow Grocery"],
"upvoted": [],
"rounded_price": 123,
}

0 comments on commit c5b4f1c

Please sign in to comment.