def test_wrong_parameter(self): with self.assertRaises(AssertionError): Attribute.from_style(Weight.BOLD) Attribute.from_variant(Style.NORMAL) Attribute.from_stretch(Weight.BOLD) Attribute.from_weight(Style.OBLIQUE) Attribute.from_size("") Attribute.from_size_absolute("a") Attribute.from_font_desc(1) Attribute.from_foreground_color("", 0, 0) Attribute.from_foreground_color(0, "", 0) Attribute.from_foreground_color(0, 0, "") Attribute.from_background_color("", 0, 0) Attribute.from_background_color(0, "", 0) Attribute.from_background_color(0, 0, "") Attribute.from_strikethrough(1) Attribute.from_strikethrough_color("", 0, 0) Attribute.from_strikethrough_color(0, "", 0) Attribute.from_strikethrough_color(0, 0, "") Attribute.from_underline(1) Attribute.from_underline_color("", 0, 0) Attribute.from_underline_color(0, "", 0) Attribute.from_underline_color(0, 0, "") Attribute.from_shape(0, 0) Attribute.from_shape(Rectangle(), 0) Attribute.from_scale(True) Attribute.from_rise("a") Attribute.from_letter_spacing(True) Attribute.from_fallback(1) Attribute.from_gravity(2) Attribute.from_gravity_hints(33) Attribute.from_font_features(23) Attribute.from_foreground_alpha("str") Attribute.from_background_alpha("foo") a = Attribute.from_size(2) a.start_index = "" a.end_index = ""
def test_from_gravity_hints(self): a = Attribute.from_gravity_hints(GravityHint.STRONG, 5, 9) b = Attribute.from_gravity_hints(GravityHint.STRONG, 5, 9) assert a.start_index == 5 assert a.end_index == 9 assert a == b