Skip to content
Browse files

unittest: add assertIsNone() and assertIsNotNone() methods to TestCase

  • Loading branch information...
dxxb authored and Paul Sokolovsky committed Nov 1, 2015
1 parent 711eba3 commit 12602899174ff93824b7214f141120536490e27f
Showing with 22 additions and 2 deletions.
  1. +1 −1 unittest/metadata.txt
  2. +1 −1 unittest/
  3. +10 −0 unittest/
  4. +10 −0 unittest/
@@ -1,3 +1,3 @@
srctype = micropython-lib
type = module
version = 0.1
version = 0.2
@@ -6,7 +6,7 @@

description='unittest module for MicroPython',
long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.",
@@ -72,6 +72,16 @@ def testIsNot(self):
with self.assertRaises(AssertionError):
self.assertIsNot(None, None)

def testIsNone(self):
with self.assertRaises(AssertionError):

def testIsNotNone(self):
with self.assertRaises(AssertionError):

def testTrue(self):
with self.assertRaises(AssertionError):
@@ -83,6 +83,16 @@ def assertIsNot(self, x, y, msg=''):
msg = "%r is %r" % (x, y)
assert x is not y, msg

def assertIsNone(self, x, msg=''):
if not msg:
msg = "%r is not None" % x
assert x is None, msg

def assertIsNotNone(self, x, msg=''):
if not msg:
msg = "%r is None" % x
assert x is not None, msg

def assertTrue(self, x, msg=''):
if not msg:
msg = "Expected %r to be True" % x

0 comments on commit 1260289

Please sign in to comment.
You can’t perform that action at this time.