Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.find by level broken #14

Open
PFython opened this issue Dec 14, 2022 · 1 comment
Open

.find by level broken #14

PFython opened this issue Dec 14, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@PFython
Copy link
Owner

PFython commented Dec 14, 2022

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!

@PFython PFython added the bug Something isn't working label Dec 14, 2022
@MikeDP
Copy link
Contributor

MikeDP commented Mar 28, 2023

Fixed in pull request #17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants