Skip to content

.find by level broken #14

Description

@PFython

I think this is my fault - many apologies Mike!

When refactoring the variable names I must've broken the level= logic, such that the following test (which I've added to test_log2d.py) doesn't work but should!:

@create_mylog
def test_find_levels():
    Log.mylog.info("Oneline")
    assert mylog.find(level="error") == []
    assert mylog.find(level="ERRor") == []
    assert len(mylog.find(level="info")) == 1
    assert len(mylog.find(level="InFo")) == 1

This test is also failing for the same reason:

def test_find_by_level():
    create_dummy_log()
    mylog.logger.error(f"Message: Yet another last line")
    result = mylog.find(text="error")
    assert "ERROR" in result[0], f"FIND5: ERROR message not found"
    result = mylog.find(text="error", ignorecase=False)
    assert not result
    result = mylog.find(level="error")
    assert len(result) == 6, f"FIND6: Expected 6 records, found {len(result)}"
    cleanup()

I'm hoping you can spot where I've gone wrong and put it right using PEP8/snake_case variable names please?

I owe you!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions