mirror of
https://github.com/HorlogeSkynet/archey4
synced 2025-06-12 16:00:12 +02:00
[ENTRY] Prevents disabled
special field from being set as options
This commit is contained in:
@ -8,6 +8,7 @@ and this project (partially) adheres to [Semantic Versioning](https://semver.org
|
||||
## [Unreleased]
|
||||
### Changed
|
||||
- Fix text width overlap regression introduced in v4.13.0
|
||||
- Prevent entries `disabled` special field from being propagated in `options`
|
||||
|
||||
## [v4.13.0] - 2021-08-29
|
||||
### Added
|
||||
|
@ -14,7 +14,7 @@ class Entry(AbstractBaseClass):
|
||||
|
||||
def __new__(cls, *_, **kwargs):
|
||||
"""Hook object instantiation to handle our particular `disabled` config field"""
|
||||
if kwargs.get('options', {}).get('disabled'):
|
||||
if kwargs.get('options', {}).pop('disabled', False):
|
||||
return None
|
||||
|
||||
return super().__new__(cls)
|
||||
|
@ -34,6 +34,9 @@ class TestEntry(unittest.TestCase):
|
||||
simple_entry = _SimpleEntry(options={'disabled': True})
|
||||
self.assertIsNone(simple_entry)
|
||||
|
||||
simple_entry = _SimpleEntry(options={'disabled': False})
|
||||
self.assertNotIn('disabled', simple_entry.options)
|
||||
|
||||
def test_entry_usage(self):
|
||||
"""Test `Entry` instantiation and parameters passing"""
|
||||
# No name passed as parameter, let's use internal defined "pretty name".
|
||||
|
Reference in New Issue
Block a user