Added an example unittest to test_utils_utils.py.
This commit is contained in:
parent
23efa02965
commit
42c0235d0d
2 changed files with 6 additions and 3 deletions
|
|
@ -1,9 +1,12 @@
|
||||||
|
# test with game/manage.py test
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from src.utils import utils
|
||||||
|
|
||||||
class TestIsIter(unittest.TestCase):
|
class TestIsIter(unittest.TestCase):
|
||||||
def test_is_iter(self):
|
def test_is_iter(self):
|
||||||
# self.assertEqual(expected, is_iter(iterable))
|
self.assertEqual(True, utils.is_iter([1,2,3,4]))
|
||||||
assert True # TODO: implement your test here
|
self.assertEqual(False, utils.is_iter("This is not an iterable"))
|
||||||
|
|
||||||
class TestCrop(unittest.TestCase):
|
class TestCrop(unittest.TestCase):
|
||||||
def test_crop(self):
|
def test_crop(self):
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,7 @@ class AttributeHandler(object):
|
||||||
"Holds default values"
|
"Holds default values"
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.value = default
|
self.value = default
|
||||||
self.strvalue = str(default)
|
self.strvalue = str(default) if default is not None else None
|
||||||
|
|
||||||
if self._cache is None or not _TYPECLASS_AGGRESSIVE_CACHE:
|
if self._cache is None or not _TYPECLASS_AGGRESSIVE_CACHE:
|
||||||
self._recache()
|
self._recache()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue