Skip to content

Commit

Permalink
Fix the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rnag committed Nov 27, 2024
1 parent 9d0be22 commit eb19dca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dataclass_wizard/wizard_cli/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

# Merge both the "truthy" and "falsy" values, so we can determine the criteria
# under which a string can be considered as a boolean value.
_FALSY_VALUES = {'FALSE', 'F', 'NO', 'N', '0'}
_FALSY_VALUES = {'false', 'f', 'no', 'n', 'off', '0'}
_BOOL_VALUES = _TRUTHY_VALUES | _FALSY_VALUES

# Valid types for JSON contents; this can be either a list of any type,
Expand Down Expand Up @@ -306,7 +306,7 @@ def can_be_bool(o: str) -> bool:
to be one.
"""
return o.upper() in _BOOL_VALUES
return o.lower() in _BOOL_VALUES


class PyDataType(Enum):
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/environ/test_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

from dataclass_wizard import EnvWizard, json_field
from dataclass_wizard.errors import MissingVars, ParseError, ExtraData
import dataclass_wizard.bases_meta


from ...conftest import *

Expand Down Expand Up @@ -438,3 +440,7 @@ class _(EnvWizard.Meta):
# assert that the __init__() method declaration is logged
assert mock_debug_log.records[-1].levelname == 'DEBUG'
assert 'Generated function code' in mock_debug_log.records[-2].message

# reset global flag for other tests that
# rely on `debug_enabled` functionality
dataclass_wizard.bases_meta._debug_was_enabled = False

0 comments on commit eb19dca

Please sign in to comment.