{"id":31228,"date":"2023-03-13T09:25:10","date_gmt":"2023-03-13T16:25:10","guid":{"rendered":"https:\/\/coderpad.io\/?p=31228"},"modified":"2023-08-03T14:43:28","modified_gmt":"2023-08-03T21:43:28","slug":"tiny-interview-python-unit-testing","status":"publish","type":"post","link":"https:\/\/coderpad.io\/blog\/coding-challenges\/tiny-interview-python-unit-testing\/","title":{"rendered":"Code Challenge: Python Unit Testing"},"content":{"rendered":"\n<p><a href=\"https:\/\/coderpad.io\/blog\/development\/a-guide-to-database-unit-testing-with-pytest-and-sqlalchemy\/\">Unit tests<\/a> ideally test a small unit (or rather, amount) of code.&nbsp;For this code challenge, we have created 20 bad functions, write testcases to break them all! The reference function is&nbsp;<code>count_islands<\/code>&nbsp;which behaves as expected.<\/p>\n\n\n\n<p>Challenge your assumptions and make sure you understand what&nbsp;<code>count_islands<\/code>&nbsp;actually does.<\/p>\n\n\n<div\n\tclass=\"sandbox-embed responsive-embed  sandbox-embed--full-width\"\n\tstyle=\"padding-top: 125%\"\ndata-block-name=\"coderpad-sandbox-embed\">\n\t<iframe src=\"https:\/\/embed.coderpad.io\/sandbox?question_id=231004&#038;use_question_button\" width=\"640\" height=\"800\" loading=\"lazy\" aria-label=\"Try out the CoderPad sandbox\"><\/iframe>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">More resources<\/h2>\n\n\n\n<p>We have made available these extra resources to improve your Python coding skills:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/coderpad.io\/interview-questions\/python-interview-questions\/\">25+ interview questions for Python<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"markdown-want-to-conduct-interviews-on-this-platform\">Want to conduct interviews on this platform?<\/h2>\n\n\n\n<p>Check out CoderPad : pick any interview question or create your own, then invite your candidate to a shared live-coding session on an IDE like this one. You even get 2 free interviews per month forever using&nbsp;<a href=\"https:\/\/app.coderpad.io\/register?source=Tiny+Interviews\">this registration link<\/a>!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Unit tests ideally test a small unit (or rather, amount) of code.\u00a0For this code challenge, we have created 20 bad functions, write testcases to break them all!<\/p>\n","protected":false},"author":1,"featured_media":31876,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[22],"tags":[],"persona":[29],"blog-programming-language":[37],"keyword-cluster":[],"class_list":["post-31228","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding-challenges"],"acf":[],"_links":{"self":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/posts\/31228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/comments?post=31228"}],"version-history":[{"count":15,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/posts\/31228\/revisions"}],"predecessor-version":[{"id":35832,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/posts\/31228\/revisions\/35832"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/media\/31876"}],"wp:attachment":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/media?parent=31228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/categories?post=31228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/tags?post=31228"},{"taxonomy":"persona","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/persona?post=31228"},{"taxonomy":"blog-programming-language","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/blog-programming-language?post=31228"},{"taxonomy":"keyword-cluster","embeddable":true,"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/keyword-cluster?post=31228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}