rm-hull / luma.oled

Python module to drive a SSD1306 / SSD1309 / SSD1322 / SSD1325 / SSD1327 / SSD1331 / SSD1351 / SH1106 OLED
https://luma-oled.readthedocs.io
MIT License
811 stars 163 forks source link

baseline_data.py is 236 KB #178

Closed thijstriemstra closed 7 years ago

thijstriemstra commented 7 years ago

https://github.com/rm-hull/luma.oled/blob/master/tests/baseline_data.py is currently 236 KB and filled with data that is not appropriate, or suitable, to store in a python source file. I think we should move it to separate files, something like demo_ssd1306.dat or whatever. It could hold a pickled version of the data which would be loaded for every test (suite) (?).

rm-hull commented 7 years ago

Yup it's getting (gone past) unsustainable. Think pickling might be the way to go here, one file per device/test as you suggest.

thijstriemstra commented 7 years ago

Decided json makes more sense. Exporting them now using:

import io
import json
import os.path

from baseline_data import demo_ssd1351

print(demo_ssd1351)

fpath = os.path.join('reference', 'data', 'demo_ssd1351.json')

with io.open(fpath, 'w', encoding='utf-8') as f:
    f.write(json.dumps(demo_ssd1351, ensure_ascii=False))