Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Snippet for "Why Refactoring? How to Refactor/Restructure Python Package?" https://hackernoon.com/why-refactoring-how-to-restructure-python-package-51b89aa91987
"""
Package: utils.tests
Faulty Test Cases
"""
import unittest
class UtilsTestCase(unittest.TestCase):
def setUp(self):
pass
def test_is_empty(self):
from utils.common.helpers import is_empty
# Problem: there is no assertion
is_empty('')
is_empty(None)
is_empty('', object_type='json')
is_empty('{}', object_type='json')
def test_is_ok(self):
# Problem: this is empty.
pass
def test_is_number(self):
# Problem: this will pass.
if not is_empty(''):
print('Fail')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment