Skip to content

Instantly share code, notes, and snippets.

@Z4HRA-S
Created August 19, 2022 21:05
Show Gist options
  • Save Z4HRA-S/0f87d540da23e179c4391ce428fd3793 to your computer and use it in GitHub Desktop.
Save Z4HRA-S/0f87d540da23e179c4391ce428fd3793 to your computer and use it in GitHub Desktop.
class TestMain(unittest.TestCase):
def test_sold_product_percent(self):
# Arrange
session = mock.Mock()
session.query().group_by().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