Mercurial > hg > numerics
view tests/test_conformity.py @ 193:dc495f0b5ee8 default tip
[testing] toxify
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 13 Aug 2017 15:52:01 -0700 |
parents | 100697f7c195 |
children |
line wrap: on
line source
#!/usr/bin/env python """ test conformity """ import unittest from numerics import conformity class TestConformity(unittest.TestCase): """tests for ensuring data conformity""" def test_equal_lengths(self): data = [[1,2,3], [4,5,6], [7,8,9]] assert conformity.ensure_row_length(data) == 3 def test_nonequal_lengths(self): data = [[1,2,3], [4,5,6], [7,8,9, 10] # oops! ] e = None try: conformity.ensure_row_length(data) except conformity.NonConformantRowLengths as e: pass assert e is not None assert isinstance(e, conformity.NonConformantRowLengths) if __name__ == '__main__': unittest.main()