def test_choice_register(self): cr = ChoiceRegister([1, 2]) assert cr.size == 1 assert cr.value == '1' cr.value = 2 assert cr.value == '2' cr.value = '1' assert cr.value == '1' try: cr.value = 3 except ValueError, e: assert unicode(e) == u'Nežinomas pasirinkimas.'
cr = ChoiceRegister([1, 2]) assert cr.size == 1 assert cr.value == '1' cr.value = 2 assert cr.value == '2' cr.value = '1' assert cr.value == '1' try: cr.value = 3 except ValueError, e: assert unicode(e) == u'Nežinomas pasirinkimas.' else: self.fail(u'turėjo būti išmesta išimtis.'.encode('utf-8')) cr = ChoiceRegister(['a', 'bb', 'c']) assert cr.size == 2 assert cr.value == ' a' cr.value = 'bb' assert cr.value == 'bb' cr.value = 'a' assert cr.value == ' a' cr.value = ' c' assert cr.value == ' c' def test_status_flag_register(self): sf = StatusFlagRegister() assert sf.CF == False assert sf.ZF == False assert sf.SF == False