Does it make sense to organize screen resolutions?
I write a lot of selenium tests, often which I need to choose a resolution for the browser. I ended up creating a dictionary with some of the more common resolutions I need to test, but I've never been happy with it.
DIMENSIONS = {
# 4:3
"1024": (1024, 768),
"1280": (1280, 960),
"1600": (1600, 1200),
"1920": (1920, 1440),
# 16:9
"720": (1280, 720),
"1080": (1920, 1080),
"1440": (2560, 1440),
"2160": (3840, 2160), # 4k
"4320": (7680, 4320), # 8k
}
Issues I have with this:
- references to a specific size requires using a string since variables in python cannot start with a number.
- dictionary lookups don't provide nice code traceability.
I figure I could use a letter in front of keys (e.g. R_1080) and then create something like an Enum or a dataclass but for some reason that didn't sit right with me either.
I can't decide if I'm overthinking things or if there is clearly another approach.
Is there a better way to organize resolutions? Should I bother?