def get_flag_html(self, scale=1.0): # flags are expected to be 32x21 width = int(round(32.0 * scale)) height = int(round(21.0 * scale)) html = '<img src="{}" width="{}" height="{}">' output = html.format(countries.get_flag_img_path(self.flag), width, height) return Markup(output)
def get_flag_html(self, scale=1.0): # flags are expected to be 32x21 width = int(round(32.0 * scale)) height = int(round(21.0 * scale)) html = '<img src="{}" width="{}" height="{}">' output = html.format( countries.get_flag_img_path(self.flag), width, height) return Markup(output)
def test_get_flag_img_path(self): self.assertEqual(get_flag_img_path( 'us'), '/static/img/valve_flags/us.png') self.assertEqual(get_flag_img_path( 'US'), '/static/img/valve_flags/us.png') self.assertEqual(get_flag_img_path( 'fr'), '/static/img/valve_flags/fr.png') self.assertEqual(get_flag_img_path( 'FR'), '/static/img/valve_flags/fr.png') self.assertEqual(get_flag_img_path('f'), '/static/img/_unknown.png') self.assertEqual(get_flag_img_path(''), '/static/img/_unknown.png')
def test_get_flag_img_path(self): self.assertEqual(get_flag_img_path('us'), '/static/img/valve_flags/us.png') self.assertEqual(get_flag_img_path('US'), '/static/img/valve_flags/us.png') self.assertEqual(get_flag_img_path('fr'), '/static/img/valve_flags/fr.png') self.assertEqual(get_flag_img_path('FR'), '/static/img/valve_flags/fr.png') self.assertEqual(get_flag_img_path('f'), '/static/img/_unknown.png') self.assertEqual(get_flag_img_path(''), '/static/img/_unknown.png')