Skip to content

Instantly share code, notes, and snippets.

@melvinkcx
Last active June 30, 2019 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melvinkcx/9045f6317597cac41d0b8478f9da180f to your computer and use it in GitHub Desktop.
Save melvinkcx/9045f6317597cac41d0b8478f9da180f to your computer and use it in GitHub Desktop.
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