tests: add some attribute tests
pylib: added a generic function to set general attribute