def test_trait_cast_trait_factory(self): int_trait_factory = TraitFactory(lambda: Int().as_ctrait()) with reset_trait_factory(): result = trait_cast(int_trait_factory) ct = int_trait_factory.as_ctrait() self.assertIsInstance(result, CTrait) self.assertIs(result, ct)
This trait accepts either a toolkit-specific font object, or a string containing a font description. The string description can contain: * a font name or family. The following generic names are understood: "default", "decorative", "roman", "script", "swiss", and "modern". * a size, in points. * a style, which is one of: "slant" or "italic" * a weight, which is one of: "light" or "bold" * whether the font is underlined, indicated by the inclusion of "underlined". Where values aren't supplied, the application defaults will be used instead. The default value is the application default font, which is toolkit and platform dependent. The default editor is FontEditor. Parameters ---------- **metadata Trait metadata to be passed through. """ return toolkit().font_trait(*args, **traits) Color = TraitFactory(ColorTrait) RGBColor = TraitFactory(RGBColorTrait) Font = TraitFactory(FontTrait)