1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
5 Tests for L{twisted.internet._pollingfile}.
8 from twisted.python.runtime import platform
9 from twisted.trial.unittest import TestCase
11 if platform.isWindows():
12 from twisted.internet import _pollingfile
18 class TestPollableWritePipe(TestCase):
20 Tests for L{_pollingfile._PollableWritePipe}.
23 def test_writeUnicode(self):
25 L{_pollingfile._PollableWritePipe.write} raises a C{TypeError} if an
26 attempt is made to append unicode data to the output buffer.
28 p = _pollingfile._PollableWritePipe(1, lambda: None)
29 self.assertRaises(TypeError, p.write, u"test")
32 def test_writeSequenceUnicode(self):
34 L{_pollingfile._PollableWritePipe.writeSequence} raises a C{TypeError}
35 if unicode data is part of the data sequence to be appended to the
38 p = _pollingfile._PollableWritePipe(1, lambda: None)
39 self.assertRaises(TypeError, p.writeSequence, [u"test"])
40 self.assertRaises(TypeError, p.writeSequence, (u"test", ))
45 if _pollingfile is None:
46 TestPollableWritePipe.skip = "Test will run only on Windows."