44import os
55from unittest import mock
66
7- import pytest as pytest
8-
97import mqttwarn .services .file
8+ import pytest as pytest
109from mqttwarn .model import ProcessorItem as Item
1110
1211
@@ -41,7 +40,10 @@ def test_file_success(fake_filesystem, srv, caplog, item):
4140
4241 assert outcome is True
4342 assert "Writing to file `/tmp/testdrive.log'" in caplog .messages
44- assert open ("/tmp/testdrive.log" , mode = "r" , encoding = "utf-8" ).read () == "\u26bd Notification message \u26bd "
43+ assert (
44+ open ("/tmp/testdrive.log" , mode = "r" , encoding = "utf-8" ).read ()
45+ == "\u26bd Notification message \u26bd "
46+ )
4547
4648
4749@mock .patch ("io.open" , side_effect = Exception ("something failed" ))
@@ -66,10 +68,7 @@ def test_file_failure(fake_filesystem, srv, caplog):
6668 assert not os .path .exists ("/tmp/testdrive.log" )
6769
6870 assert outcome is False
69- assert (
70- "Cannot write to file `/tmp/testdrive.log': something failed"
71- in caplog .messages
72- )
71+ assert "Cannot write to file `/tmp/testdrive.log': something failed" in caplog .messages
7372
7473
7574@pytest .mark .parametrize (
@@ -107,7 +106,10 @@ def test_file_append_newline_success(fake_filesystem, srv, caplog, item):
107106 assert outcome1 is True
108107 assert outcome2 is True
109108 assert "Writing to file `/tmp/testdrive.log'" in caplog .messages
110- assert open ("/tmp/testdrive.log" , mode = "r" , encoding = "utf-8" ).read () == "\u26bd Notification message \u26bd \n \u26bd Notification message \u26bd \n "
109+ assert (
110+ open ("/tmp/testdrive.log" , mode = "r" , encoding = "utf-8" ).read ()
111+ == "\u26bd Notification message \u26bd \n \u26bd Notification message \u26bd \n "
112+ )
111113
112114
113115@pytest .mark .parametrize (
@@ -146,4 +148,7 @@ def test_file_overwrite_success(fake_filesystem, srv, caplog, item):
146148 assert outcome1 is True
147149 assert outcome2 is True
148150 assert "Writing to file `/tmp/testdrive.log'" in caplog .messages
149- assert open ("/tmp/testdrive.log" , mode = "r" , encoding = "utf-8" ).read () == "\u26bd Notification message \u26bd "
151+ assert (
152+ open ("/tmp/testdrive.log" , mode = "r" , encoding = "utf-8" ).read ()
153+ == "\u26bd Notification message \u26bd "
154+ )
0 commit comments