2019-06-23 05:17:14 +00:00
|
|
|
from pyqtgraph import configfile
|
|
|
|
import numpy as np
|
|
|
|
|
2021-05-28 14:39:00 +00:00
|
|
|
def test_longArrays(tmpdir):
|
2019-06-23 05:17:14 +00:00
|
|
|
"""
|
|
|
|
Test config saving and loading of long arrays.
|
|
|
|
"""
|
|
|
|
arr = np.arange(20)
|
|
|
|
|
2021-05-28 14:39:00 +00:00
|
|
|
tf = tmpdir.join("config.cfg")
|
|
|
|
configfile.writeConfigFile({'arr': arr}, tf)
|
|
|
|
config = configfile.readConfigFile(tf)
|
|
|
|
assert all(config['arr'] == arr)
|
2019-06-23 05:17:14 +00:00
|
|
|
|
2021-05-28 14:39:00 +00:00
|
|
|
def test_multipleParameters(tmpdir):
|
2019-06-23 05:17:14 +00:00
|
|
|
"""
|
|
|
|
Test config saving and loading of multiple parameters.
|
|
|
|
"""
|
|
|
|
|
|
|
|
par1 = [1,2,3]
|
|
|
|
par2 = "Test"
|
|
|
|
par3 = {'a':3,'b':'c'}
|
|
|
|
|
2021-05-28 14:39:00 +00:00
|
|
|
tf = tmpdir.join("config.cfg")
|
|
|
|
configfile.writeConfigFile({'par1':par1, 'par2':par2, 'par3':par3}, tf)
|
|
|
|
config = configfile.readConfigFile(tf)
|
|
|
|
|
2019-06-23 05:17:14 +00:00
|
|
|
assert config['par1'] == par1
|
|
|
|
assert config['par2'] == par2
|
|
|
|
assert config['par3'] == par3
|