#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest class test_stats_deviceStats(unittest.TestCase): def valueChanged(self,varName:str="") -> bool: from Stats import Stats s:Stats = Stats() # Unlock Angry-Stat s.DeviceStats.lock(varName,-1.0) oldValue:float=s.DeviceStats.get(varName) newValue:float=oldValue+10.0 s.DeviceStats.set(varName,newValue) return s.DeviceStats.get(varName)==newValue def test_deviceStats_angry_Value_Changed(self): from Stats import Stats s:Stats = Stats() # Unlock Angry-Stat s.DeviceStats._locked_angry=-1.0 oldValue:float=s.DeviceStats.angry newValue:float=oldValue+10.0 s.DeviceStats.angry=newValue self.assertEqual(s.DeviceStats.angry, newValue) def test_deviceStats_aroused_Value_Changed(self): self.assertTrue(self.valueChanged("aroused")) def test_deviceStats_hungry_Value_Changed(self): self.assertTrue(self.valueChanged("hungry")) def test_deviceStats_happyness_Value_Changed(self): self.assertTrue(self.valueChanged("happyness")) def test_deviceStats_funny_Value_Changed(self): self.assertTrue(self.valueChanged("funny")) def test_deviceStats_annoyed_Value_Changed(self): self.assertTrue(self.valueChanged("annoyed")) def test_deviceStats_irritated_Value_Changed(self): self.assertTrue(self.valueChanged("irritated")) def test_deviceStats_bored_Value_Changed(self): self.assertTrue(self.valueChanged("bored")) def test_deviceStats_intelligent_Value_Changed(self): self.assertTrue(self.valueChanged("intelligent")) def test_deviceStats_sleepy_Value_Changed(self): self.assertTrue(self.valueChanged("sleepy")) def test_deviceStats_energy_Value_Changed(self): self.assertTrue(self.valueChanged("energy")) def test_deviceStats_exhausted_Value_Changed(self): self.assertTrue(self.valueChanged("exhausted")) def test_deviceStats_depressive_Value_Changed(self): self.assertTrue(self.valueChanged("depressive")) def test_deviceStats_sad_Value_Changed(self): self.assertTrue(self.valueChanged("sad")) def test_deviceStats_useless_Value_Changed(self): self.assertTrue(self.valueChanged("useless")) def test_deviceStats_usefull_Value_Changed(self): self.assertTrue(self.valueChanged("usefull")) def test_deviceStats_compfortable_Value_Changed(self): self.assertTrue(self.valueChanged("compfortable")) def test_deviceStats_temperate_Value_Changed(self): self.assertTrue(self.valueChanged("temperate")) def test_deviceStats_shy_Value_Changed(self): self.assertTrue(self.valueChanged("shy")) def test_deviceStats_excited_Value_Changed(self): self.assertTrue(self.valueChanged("excited")) def test_deviceStats_toLoud_Value_Changed(self): self.assertTrue(self.valueChanged("toLoud")) def test_deviceStats_toQuiet_Value_Changed(self): self.assertTrue(self.valueChanged("toQuiet")) def test_deviceStats_playful_Value_Changed(self): self.assertTrue(self.valueChanged("playful")) def test_deviceStats_naiv_Value_Changed(self): self.assertTrue(self.valueChanged("naiv")) def test_deviceStats_freezy_Value_Changed(self): self.assertTrue(self.valueChanged("freezy")) def test_deviceStats_hot_Value_Changed(self): self.assertTrue(self.valueChanged("hot")) def test_deviceStats_humanity_Value_Changed(self): self.assertTrue(self.valueChanged("humanity")) def test_deviceStats_lonely_Value_Changed(self): self.assertTrue(self.valueChanged("lonely")) def test_deviceStats_soziality_Value_Changed(self): self.assertTrue(self.valueChanged("soziality")) def test_deviceStats_Fixed_Value_Changed(self): from Stats import Stats s:Stats = Stats() # Lock Angry-Stat s.DeviceStats._locked_angry = 150.0 s.DeviceStats.angry=500 self.assertEqual(s.DeviceStats.angry, 150) if __name__ == '__main__': unittest.main()