Created
January 12, 2018 03:15
-
-
Save dunossauro/eb1f3aa236b8b3b140eefee96b3fded4 to your computer and use it in GitHub Desktop.
Rapidinha de Python #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Gist para rapidinha #5: https://youtu.be/95_tm5jh5Gc | |
""" | |
from io import StringIO | |
from unittest import main, TestCase | |
from unittest.mock import patch | |
def stdout(string): | |
print(string) | |
class Test_stdout(TestCase): | |
def test_stdout(self): | |
resultado_esperado = 'Rapidinha de Python\n' | |
with patch('sys.stdout', new=StringIO()) as fake_out: | |
stdout('Rapidinha de Python') | |
self.assertEqual(fake_out.getvalue(), resultado_esperado) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment