• Mocking in Python

checkio

Hi, guys!

Check out some of our plans for this year!

Challenge yourself with our latest missions:

The first mission is called “Univocalic davasaan” created by Phil15 and here you have to write a function named davasaan which calculates the integer division by 10, and make your code as short as possible.

The second one is the “Tree Walker” mission created by quarkov where you are given a tree and a target and your task is to calculate the number of leaves or subtrees that are equal to the target.

tree_walker(tree=[1, "2", 3, [[3], 1, {1: "one"}]], target=1) == 2                                        #example #1
tree_walker(tree={"one": 1, "two": [{1: "one", 2: "two"}, 1, "1", "one"]}, target=1) == 2                 #example #2
tree_walker(tree={"one": [1, 2], "two": [{1: "one", 2: "two"}, [1, 2], "1", "one"]}, target=[1, 2]) == 2  #example #3
tree_walker(tree=5, target=5) == 1                                                                        #example #4
    Highlights from the world of Python:
  • “Understanding the Python Mock Object Library” is the highly detailed article that describes how mocking works in Python. If you are interested in finding out how to create Python mock objects using Mock, inspect usage data stored on your Python mocks, substitute your mocks for real objects using patch(), configure certain aspects of your Python mock objects, avoid common problems inherent in Python mocking, etc. and see it explained with great examples, then this if just what you are looking for.
  • Mocking is a powerful technique for isolating tests from undesired interactions among components. But sometimes you might not get the desired effect. Find out why your mock doesn’t work.
  • A highly useful cheatsheet for mocking in Python. You have to have this!

Our congratulations to the winner of December 2019 - HeNeArKr - you are totally Awesome and we are very glad to have you here with us!

Little by little CheckiO is starting to grow and now we have an opportunity to add a new Content-Hero and the Mission-Creation-Monster into our team part-time. Together we’ll work on CheckiO and Empire of Code. Are you interested? Then fill in this simple form so we could find out a little bit more about you and how we can get in touch.

Become Awesome

  • No Ads
  • No Limits
  • More Content

Welcome to CheckiO - games for coders where you can improve your codings skills.

The main idea behind these games is to give you the opportunity to learn by exchanging experience with the rest of the community. Every day we are trying to find interesting solutions for you to help you become a better coder.

Join the Game