mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-20 18:48:45 -06:00
Fix PEP8: remove trailing whitespace from blank lines
This commit is contained in:
@@ -210,10 +210,10 @@ class ModularComponentTemplateModel(ComponentTemplateModel):
|
|||||||
def resolve_position(self, position, module):
|
def resolve_position(self, position, module):
|
||||||
"""
|
"""
|
||||||
Resolve {module} placeholder in position field.
|
Resolve {module} placeholder in position field.
|
||||||
|
|
||||||
This is used by ModuleBayTemplate to resolve positions like "{module}/1"
|
This is used by ModuleBayTemplate to resolve positions like "{module}/1"
|
||||||
to actual values like "A/1" when the parent module is installed in bay "A".
|
to actual values like "A/1" when the parent module is installed in bay "A".
|
||||||
|
|
||||||
Fixes Issue #20467.
|
Fixes Issue #20467.
|
||||||
"""
|
"""
|
||||||
if not position or MODULE_TOKEN not in position:
|
if not position or MODULE_TOKEN not in position:
|
||||||
|
|||||||
@@ -972,10 +972,10 @@ class ModuleBayTestCase(TestCase):
|
|||||||
def test_module_bay_position_resolves_placeholder(self):
|
def test_module_bay_position_resolves_placeholder(self):
|
||||||
"""
|
"""
|
||||||
Test that the position field of instantiated module bays resolves {module} placeholder.
|
Test that the position field of instantiated module bays resolves {module} placeholder.
|
||||||
|
|
||||||
Issue #20467: When a module type has module bay templates with position="{module}/1",
|
Issue #20467: When a module type has module bay templates with position="{module}/1",
|
||||||
the instantiated module bay should have position="A/1" (not literal "{module}/1").
|
the instantiated module bay should have position="A/1" (not literal "{module}/1").
|
||||||
|
|
||||||
This test should:
|
This test should:
|
||||||
- FAIL on main branch (bug present: position contains "{module}")
|
- FAIL on main branch (bug present: position contains "{module}")
|
||||||
- PASS after fix (position is resolved to actual value)
|
- PASS after fix (position is resolved to actual value)
|
||||||
@@ -1033,15 +1033,15 @@ class ModuleBayTestCase(TestCase):
|
|||||||
# Verify the nested bays have resolved names (this already works)
|
# Verify the nested bays have resolved names (this already works)
|
||||||
nested_bay_1 = module.modulebays.get(name='Sub Bay A-1')
|
nested_bay_1 = module.modulebays.get(name='Sub Bay A-1')
|
||||||
nested_bay_2 = module.modulebays.get(name='Sub Bay A-2')
|
nested_bay_2 = module.modulebays.get(name='Sub Bay A-2')
|
||||||
|
|
||||||
# Verify labels are resolved (this already works)
|
# Verify labels are resolved (this already works)
|
||||||
self.assertEqual(nested_bay_1.label, 'A-1')
|
self.assertEqual(nested_bay_1.label, 'A-1')
|
||||||
self.assertEqual(nested_bay_2.label, 'A-2')
|
self.assertEqual(nested_bay_2.label, 'A-2')
|
||||||
|
|
||||||
# Verify POSITION field is resolved (Issue #20467 - this currently fails)
|
# Verify POSITION field is resolved (Issue #20467 - this currently fails)
|
||||||
self.assertEqual(nested_bay_1.position, 'A/1')
|
self.assertEqual(nested_bay_1.position, 'A/1')
|
||||||
self.assertEqual(nested_bay_2.position, 'A/2')
|
self.assertEqual(nested_bay_2.position, 'A/2')
|
||||||
|
|
||||||
# Also verify no {module} literal remains
|
# Also verify no {module} literal remains
|
||||||
self.assertNotIn('{module}', nested_bay_1.position)
|
self.assertNotIn('{module}', nested_bay_1.position)
|
||||||
self.assertNotIn('{module}', nested_bay_2.position)
|
self.assertNotIn('{module}', nested_bay_2.position)
|
||||||
|
|||||||
Reference in New Issue
Block a user