Fix health bar unittest

This commit is contained in:
Griatch 2019-02-23 22:30:40 +01:00
parent 1a7b596abc
commit b0a71b8763

View file

@ -677,8 +677,21 @@ from evennia.contrib import health_bar
class TestHealthBar(EvenniaTest):
def test_healthbar(self):
expected_bar_str = "|[G|w |n|[B|w test24 / 200test |n"
self.assertTrue(health_bar.display_meter(24, 200, length=40, pre_text="test", post_text="test", align="center") == expected_bar_str)
expected_bar_str = '|[R|w|n|[B|w test0 / 200test |n'
self.assertEqual(health_bar.display_meter(
0, 200, length=40, pre_text="test", post_text="test", align="center"), expected_bar_str)
expected_bar_str = "|[R|w |n|[B|w test24 / 200test |n"
self.assertEqual(health_bar.display_meter(
24, 200, length=40, pre_text="test", post_text="test", align="center"), expected_bar_str)
expected_bar_str = '|[Y|w test100 /|n|[B|w 200test |n'
self.assertEqual(health_bar.display_meter(
100, 200, length=40, pre_text="test", post_text="test", align="center"), expected_bar_str)
expected_bar_str = '|[G|w test180 / 200test |n|[B|w |n'
self.assertEqual(health_bar.display_meter(
180, 200, length=40, pre_text="test", post_text="test", align="center"), expected_bar_str)
expected_bar_str = '|[G|w test200 / 200test |n|[B|w|n'
self.assertEqual(health_bar.display_meter(
200, 200, length=40, pre_text="test", post_text="test", align="center"), expected_bar_str)
# test mail contrib