def test_wantOneDeprecated(self): """ L{twisted.conch.insults.helper.CharacterAttribute.wantOne} emits a deprecation warning when invoked. """ # Trigger the deprecation warning. helper._FormattingState().wantOne(bold=True) warningsShown = self.flushWarnings([self.test_wantOneDeprecated]) self.assertEqual(len(warningsShown), 1) self.assertEqual(warningsShown[0]['category'], DeprecationWarning) self.assertEqual( warningsShown[0]['message'], 'twisted.conch.insults.helper.wantOne was deprecated in ' 'Twisted 13.1.0')
def test_wantOneDeprecated(self): """ L{twisted.conch.insults.helper.CharacterAttribute.wantOne} emits a deprecation warning when invoked. """ # Trigger the deprecation warning. helper._FormattingState().wantOne(bold=True) warningsShown = self.flushWarnings([self.test_wantOneDeprecated]) self.assertEqual(len(warningsShown), 1) self.assertIdentical(warningsShown[0]['category'], DeprecationWarning) self.assertEqual( warningsShown[0]['message'], 'twisted.conch.insults.helper.wantOne was deprecated in ' 'Twisted 13.1.0')
def test_wantOneDeprecated(self): """ L{twisted.conch.insults.helper.CharacterAttribute.wantOne} emits a deprecation warning when invoked. """ # Trigger the deprecation warning. helper._FormattingState().wantOne(bold=True) warningsShown = self.flushWarnings([self.test_wantOneDeprecated]) self.assertEqual(len(warningsShown), 1) self.assertEqual(warningsShown[0]["category"], DeprecationWarning) deprecatedClass = "twisted.conch.insults.helper._FormattingState.wantOne" self.assertEqual( warningsShown[0]["message"], "%s was deprecated in Twisted 13.1.0" % (deprecatedClass), )
def assembleFormattedText(formatted): """ Assemble formatted text from structured information. Currently handled formatting includes: bold, blink, reverse, underline and color codes. For example:: from twisted.conch.insults.text import attributes as A assembleFormattedText( A.normal[A.bold['Time: '], A.fg.lightRed['Now!']]) Would produce "Time: " in bold formatting, followed by "Now!" with a foreground color of light red and without any additional formatting. @param formatted: Structured text and attributes. @rtype: C{str} @return: String containing VT102 control sequences that mimic those specified by L{formatted}. @see: L{twisted.conch.insults.text.attributes} @since: 13.1 """ return _textattributes.flatten( formatted, helper._FormattingState(), 'toVT102')
def assembleFormattedText(formatted): """ Assemble formatted text from structured information. Currently handled formatting includes: bold, blink, reverse, underline and color codes. For example:: from twisted.conch.insults.text import attributes as A assembleFormattedText( A.normal[A.bold['Time: '], A.fg.lightRed['Now!']]) Would produce "Time: " in bold formatting, followed by "Now!" with a foreground color of light red and without any additional formatting. @param formatted: Structured text and attributes. @rtype: C{str} @return: String containing VT102 control sequences that mimic those specified by L{formatted}. @see: L{twisted.conch.insults.text.attributes} @since: 13.1 """ return _textattributes.flatten(formatted, helper._FormattingState(), 'toVT102')
def _currentFormattingState(self): return helper._FormattingState(self.activeCharset, **self.graphicRendition)
def setUp(self): self.attrs = helper._FormattingState()
def setUp(self): self.attrs = helper._FormattingState()
def _currentFormattingState(self): return helper._FormattingState(self.activeCharset, **self.graphicRendition)