Skip to content

Instantly share code, notes, and snippets.

@Z4HRA-S
Created August 19, 2022 19:47
Show Gist options
  • Save Z4HRA-S/eb696e9103de1332cdbf06bec7ba527f to your computer and use it in GitHub Desktop.
Save Z4HRA-S/eb696e9103de1332cdbf06bec7ba527f to your computer and use it in GitHub Desktop.
def test_decoupled_sold_product_percent(self):
# Arrange
session = mock.Mock()
session.query.return_value = session
session.filter.return_value = session
session.where.return_value = session
session.group_by.return_value = session
session.all.return_value = [(76, 'cheese_cake'),
(67, 'chocolate_cake'),
(70, 'coffee'),
(17, 'hot_dog'),
(70, 'tea')]
# Act
output = sold_product_percent(session)
# Assert
assert type(output) == dict
assert 99 < sum(output.values()) < 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment