def test_toXML(self): s = '<state><Power value="On"/><Position value="(0, 0)"/><Zoom value="0.0"/></state>' state = State() state['Power'] = 'On' state['Position'] = (0,0) state['Zoom'] = 0.0 assert state.toXML() == s
def test_tofrom_file(self): state = State() state['Power'] = 'On' state['Position'] = (0,1) state['Zoom'] = 0 state.toFile('tmp.conf') state2 = State() state2.fromFile('tmp.conf') os.remove('tmp.conf') assert state == state2
def test_is_iterable(self): state = State() assert state.iterkeys() is not None
def test_from_XML2(self): string = '<state><Power value="On"/><PanSpeed value="0.133"/><Position value="(-27, 2)"/><Speed value="0.133"/><TiltSpeed value="0.134"/><Zoom value="0.734"/></state>' state = State(string) assert state.toXML() == string