pyqtgraph/tests/test_configparser.py
Ogi Moore a6971c768d Move and Update test-data repo into pyqtgraph repo
To reduce complexity, and make it easier to add more images and tests,
the images in the `test-data` repository should be merged with the main
repository.  Furthermore, we can remove a lot of the subprocess work in
the image_testing.py file, as we no longer need to have it interact with
git.

The images are not the same.  Images were regenerated with Qt6, and now
have proper big and little endian handling thanks to @pijyoi

Second commit is a slightly modified variant of
2e135ab282d6007b34a3854921be54d0e9efb241 authored by @pijyoi
it is to convert qimages to RGBA8888 for testing.  Image
files were regenerated images for the big/little handling

Fixed issue with bogus test from test_NonUniformImage and generated a
new image
2021-05-31 21:05:00 -07:00

37 lines
832 B
Python

from pyqtgraph import configfile
import numpy as np
import tempfile, os
def test_longArrays():
"""
Test config saving and loading of long arrays.
"""
tmp = tempfile.mktemp(".cfg")
arr = np.arange(20)
configfile.writeConfigFile({'arr':arr}, tmp)
config = configfile.readConfigFile(tmp)
assert all(config['arr'] == arr)
os.remove(tmp)
def test_multipleParameters():
"""
Test config saving and loading of multiple parameters.
"""
tmp = tempfile.mktemp(".cfg")
par1 = [1,2,3]
par2 = "Test"
par3 = {'a':3,'b':'c'}
configfile.writeConfigFile({'par1':par1, 'par2':par2, 'par3':par3}, tmp)
config = configfile.readConfigFile(tmp)
assert config['par1'] == par1
assert config['par2'] == par2
assert config['par3'] == par3
os.remove(tmp)