lidatong / dataclasses-json

Easily serialize Data Classes to and from JSON
MIT License
1.34k stars 151 forks source link

Narrow down implicit boolean conversion introduced in 0.5.8 #468

Closed george-zubrienko closed 10 months ago

george-zubrienko commented 11 months ago

Fixes #466 (at least the boolean part of it that is defo a bug)

Enhanced builtin instantiation introduced in 0.5.8 had a side effect of converting any int in json to a True boolean value if the destination field has bool type. This PR narrows allowed value range for implicit conversion to boolean

github-actions[bot] commented 11 months ago

Coverage

Coverage Report
FileStmtsMissCoverMissing
dataclasses_json
   cfg.py51492%80, 84–86
   core.py2411096%38–41, 51, 64, 66, 81, 83, 169, 197
   mm.py2023085%33–36, 42–45, 53–56, 62–65, 88, 161–162, 167, 171, 175, 180, 184, 188, 196, 202, 207, 216, 221, 226, 235, 244–251
   stringcase.py25388%59, 76, 97
   undefined.py143299%24, 38
   utils.py1283672%11–24, 44–49, 60–64, 74, 99–100, 108–109, 124–132, 158, 177, 202
tests
   entities.py226299%229, 235
   test_annotations.py814248%50–67, 78–102, 106–122
   test_api.py142497%88, 99, 139–140
   test_str_subclass.py22195%9
   test_union.py981090%87–94, 108–115
TOTAL249814494% 

Tests Skipped Failures Errors Time
296 3 :zzz: 0 :x: 0 :fire: 5.547s :stopwatch:
george-zubrienko commented 10 months ago

Closing as this is too risky to integrate, will instead do a separate one for v1