Skip to content

Atomizer tests use list.sort() == list.sort(), which always evaluates to None == None #68

@wshlavacek

Description

@wshlavacek

Summary

tests/test_bng_atomizer.py contains two assertions of the form
list.sort() == list.sort(), which compare the return values of
list.sort(). list.sort() sorts in place and returns None, so
both sides are always None and the assertion always passes —
regardless of the actual file listing.

Locations

  • tests/test_bng_atomizer.py:23 (in test_atomize_flat)
  • tests/test_bng_atomizer.py:42 (in test_atomize_atomized)

Example (line 22–23):

file_list = os.listdir(os.path.join(tfold, "test"))
assert file_list.sort() == to_match.sort()

Why this matters

These assertions were presumably intended to verify that the atomizer
produced the expected output filename(s) in the test output directory.
Today they verify nothing — even if the atomizer wrote the wrong files,
or no files, the test would still pass.

Suggested fix

Replace each occurrence with a real comparison, e.g.:

assert sorted(file_list) == sorted(to_match)

Note: the test output directory (tests/test/) is reused across runs
rather than being a fresh tmp_path. Once the assertion is real,
stale artifacts from prior runs may make it fail; the fix likely also
needs to switch the output directory to a per-test tmp_path (or
clean tests/test/ at setup).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions