increase test coverage

This commit is contained in:
Martin Diehl 2020-11-14 19:24:31 +01:00
parent 9160677ff3
commit 149fce0a7e
3 changed files with 16 additions and 11 deletions

View File

@ -56,6 +56,8 @@ def croak(what, newline = True):
"""
Write formated to stderr.
DEPRECATED
Parameters
----------
what : str or iterable
@ -393,17 +395,6 @@ class bcolors:
UNDERLINE = '\033[4m'
CROSSOUT = '\033[9m'
def disable(self):
self.HEADER = ''
self.OKBLUE = ''
self.OKGREEN = ''
self.WARNING = ''
self.FAIL = ''
self.ENDC = ''
self.BOLD = ''
self.UNDERLINE = ''
self.CROSSOUT = ''
class return_message:
"""Object with formatted return message."""

View File

@ -17,6 +17,12 @@ def reference_dir(reference_dir_base):
class TestTable:
def test_repr(self,default):
print(default)
def test_len(self):
len(Table(np.random.rand(7,3),{'X':3})) == 7
def test_get_scalar(self,default):
d = default.get('s')
assert np.allclose(d,1.0) and d.shape[1:] == (1,)

View File

@ -15,6 +15,10 @@ class TestUtil:
out,err = util.execute('sh -c "echo $test_for_execute"',env={'test_for_execute':'test'})
assert out=='test\n' and err==''
def test_execute_invalid(self):
with pytest.raises(RuntimeError):
util.execute('/bin/false')
def test_croak(self):
util.croak('Burp!')
@ -93,3 +97,7 @@ class TestUtil:
])
def test_shapeblender(self,a,b,answer):
assert util.shapeblender(a,b) == answer
@pytest.mark.parametrize('style',[util.emph,util.deemph,util.delete,util.strikeout])
def test_decorate(self,style):
assert 'DAMASK' in style('DAMASK')