test_weight_watchers.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:weight-watchers-sync 作者: Bachmann1234 项目源码 文件源码
def test_get_calories_ww_recipe(session):
    with vcr.use_cassette("{}/{}.yaml".format(CASSETTES_HOME, 'steak_recipe.yaml')):
        # This object is actually quite more complicated. But I don't care
        food_log = {'smartPoints': 4, '_servingDesc': '1 serving(s)',
         '_displayName': 'Coffee-Chili Rubbed Flank Steak with Peppers and Onions', 'trackedDate': '2016-07-20',
         'pointsPrecise': 4.8926, 'portionSize': 1, 'isActive': True, 'entryId': '6fc42740-4e38-11e6-8237-3d072975d999',
         'points': 5, 'sourceId': 523991, 'smartPointsPrecise': 4, 'portionName': 'serving(s)',
         'name': 'Coffee-Chili Rubbed Flank Steak with Peppers and Onions', 'portionTypeId': None,
         'versionId': '57516df7f9984a6a3682ac0d', '_id': '57516df7f9984a6a3682ac0c', 'timeOfDay': 'morning',
         'sourcePortionName': 'serving(s)', 'sourcePortionId': None, 'sourceType': WW_RECIPE, 'portionId': None}
        result = get_nutrition(get_food_detail(session, food_log), food_log)
        assert result == {
            'sodium': 1089.58948,
            'protein': 26.27602775,
            'fiber': 2.48177325,
            'fat': 7.102034249999999,
            'sugar': 3.51908025,
            'saturatedFat': 2.4551232499999998,
            'carbs': 7.944517,
            'calories': 201.15632675
        }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号