@@ -30,9 +30,9 @@ def temp_text_file():
3030 f .write ("My name is John Doe and my email is john.doe@example.com.\n " )
3131 f .write ("My phone number is (555) 123-4567 and my SSN is 123-45-6789.\n " )
3232 temp_file = f .name
33-
33+
3434 yield temp_file
35-
35+
3636 # Clean up the temporary file after the test
3737 if os .path .exists (temp_file ):
3838 os .remove (temp_file )
@@ -62,24 +62,28 @@ def test_scan_text_with_file_content(runner, temp_text_file):
6262 # Read the content of the temporary file
6363 with open (temp_text_file , "r" ) as f :
6464 text_content = f .read ().strip ()
65-
65+
6666 # Run the scan-text command with the file content
6767 result = runner .invoke (app , ["scan-text" , text_content ])
68-
68+
6969 # Verify the command executed successfully
7070 assert result .exit_code == 0
71-
71+
7272 # Check that the output contains expected PII types
73- assert "PERSON" in result .stdout or "EMAIL" in result .stdout or "PHONE" in result .stdout
73+ assert (
74+ "PERSON" in result .stdout
75+ or "EMAIL" in result .stdout
76+ or "PHONE" in result .stdout
77+ )
7478
7579
7680@pytest .mark .integration
7781def test_redact_text_command (runner ):
7882 """Test the redact-text command."""
7983 test_text = "My name is John Doe and my email is john.doe@example.com."
80-
84+
8185 result = runner .invoke (app , ["redact-text" , test_text ])
82-
86+
8387 assert result .exit_code == 0
8488 # Check that PII has been redacted (replaced with [REDACTED])
8589 assert "[REDACTED]" in result .stdout
@@ -93,9 +97,9 @@ def test_redact_text_command(runner):
9397def test_replace_text_command (runner ):
9498 """Test the replace-text command."""
9599 test_text = "My name is John Doe and my email is john.doe@example.com."
96-
100+
97101 result = runner .invoke (app , ["replace-text" , test_text ])
98-
102+
99103 assert result .exit_code == 0
100104 # The person name should be replaced with a pseudonym
101105 assert "John Doe" not in result .stdout
@@ -109,7 +113,7 @@ def test_replace_text_command(runner):
109113def test_list_entities_command (runner ):
110114 """Test the list-entities command."""
111115 result = runner .invoke (app , ["list-entities" ])
112-
116+
113117 assert result .exit_code == 0
114118 # Should list some common entity types
115119 assert "PERSON" in result .stdout
0 commit comments