testing new functionality

This commit is contained in:
Martin Diehl 2022-02-22 14:00:36 +01:00
parent f6de182eb6
commit be11da2284
2 changed files with 21 additions and 0 deletions

View File

@ -42,6 +42,10 @@ class TestGrid:
print('patched datetime.datetime.now')
def test_show(sef,default,monkeypatch):
monkeypatch.delenv('DISPLAY',raising=False)
default.show()
def test_equal(self,default):
assert default == default
assert not default == 42

View File

@ -1,6 +1,7 @@
import os
import filecmp
import time
import string
import pytest
import numpy as np
@ -173,6 +174,22 @@ class TestVTK:
assert str(mask_manual) == str(mask_auto)
@pytest.mark.parametrize('data_type,shape',[(float,(3,)),
(float,(3,3)),
(float,(1,)),
(int,(4,)),
(str,(1,))])
@pytest.mark.parametrize('N_values',[5*6*7,6*7*8])
def test_labels(self,default,data_type,shape,N_values):
data = np.squeeze(np.random.randint(0,100,(N_values,)+shape)).astype(data_type)
ALPHABET = np.array(list(string.ascii_lowercase + ' '))
label = ''.join(np.random.choice(ALPHABET, size=10))
new = default.add(data,label)
if N_values == default.N_points: assert label in new.labels['Point Data']
if N_values == default.N_cells: assert label in new.labels['Cell Data']
def test_comments(self,tmp_path,default):
default.comments += 'this is a comment'
default.save(tmp_path/'with_comments',parallel=False)