diff options
| author | Alex <git@ajschof.me> | 2025-02-17 16:47:47 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-17 16:47:47 +0000 |
| commit | 00917b8ecf67de9e955479be555d74fcc8257020 (patch) | |
| tree | 17dd9b2e85866f85bdbb3702185463b13c911a28 /test/test_csv_reader.py | |
| parent | bf323b8c2ebd47bb446ba773027f389a0887e325 (diff) | |
| parent | e2b0f2553b8dfcbe39f6e6fdc86ca68cc63f5705 (diff) | |
| download | gdpr-obfuscator-00917b8ecf67de9e955479be555d74fcc8257020.tar.gz gdpr-obfuscator-00917b8ecf67de9e955479be555d74fcc8257020.zip | |
Merge pull request #3 from ajschofield/add-docs
update README & add comments in src code
Diffstat (limited to 'test/test_csv_reader.py')
| -rw-r--r-- | test/test_csv_reader.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/test/test_csv_reader.py b/test/test_csv_reader.py index e62c093..1b3d071 100644 --- a/test/test_csv_reader.py +++ b/test/test_csv_reader.py @@ -2,25 +2,27 @@ # Author: Alex Schofield from obfuscator.csv_reader import CSVReader -import pytest reader = CSVReader() - +# Check if the function can read a CSV string with no content and return +# an empty list def test_empty_csv_should_return_no_content(): content = "" result = reader.read_string(content) expected = [] assert result == expected - +# Check if the function can read a CSV string with only a header and return +# an empty list def test_csv_with_header_only_should_return_no_content(): content = "student_id,name,course\n" result = reader.read_string(content) expected = [] assert result == expected - +# Check if the function can read a CSV string with valid data and return +# a list of dictionaries def test_csv_with_valid_data(): content = ( "student_id,name,course\n" @@ -34,7 +36,8 @@ def test_csv_with_valid_data(): ] assert result == expected - +# Check if the function can read a CSV string with quoted fields and return +# a list of dictionaries with the quoted fields intact def test_csv_with_quoted_fields_should_run_as_expected(): content = ( "student_id,name,course\n" @@ -47,10 +50,3 @@ def test_csv_with_quoted_fields_should_run_as_expected(): {"student_id": "5678", "name": "Student 2", "course": "Course 2"}, ] assert result == expected - - -def test_non_csv_file_should_return_no_content(): - content = "" - result = reader.read_string(content) - expected = [] - assert result == expected |
