Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
3tilley committed Oct 29, 2021
1 parent 788106f commit 8a364bd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion colorama/tests/ansitowin32_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from io import StringIO
from io import StringIO, TextIOWrapper
from unittest import TestCase, main

try:
Expand Down Expand Up @@ -40,6 +40,17 @@ def testProxyNoContextManager(self):
with StreamWrapper(mockStream, mockConverter) as wrapper:
wrapper.write('hello')

def test_closed_shouldnt_raise_on_closed_stream(self):
stream = StringIO()
stream.close()
wrapper = StreamWrapper(stream, None)
self.assertEqual(wrapper.closed, True)

def test_closed_shouldnt_raise_on_detached_stream(self):
stream = TextIOWrapper(StringIO())
stream.detach()
wrapper = StreamWrapper(stream, None)
self.assertEqual(wrapper.closed, True)

class AnsiToWin32Test(TestCase):

Expand Down

0 comments on commit 8a364bd

Please sign in to comment.