MCPcopy Create free account
hub / github.com/bleachbit/bleachbit / test_override_with_sections

Method test_override_with_sections

tests/TestOptions.py:348–371  ·  view source on GitHub ↗

Test overrides work with different sections

(self)

Source from the content-addressed store, hash-verified

346 o.reset_overrides()
347
348 def test_override_with_sections(self):
349 """Test overrides work with different sections"""
350 o = bleachbit.Options.options
351
352 # Test override in non-default section
353 if not o.config.has_section('test_section'):
354 o.config.add_section('test_section')
355 o.config.set('test_section', 'test_key', 'original_value')
356
357 o.set_override('test_key', 'override_value', section='test_section')
358 self.assertEqual(
359 o.get('test_key', section='test_section'), 'override_value')
360
361 # Verify flush doesn't write override
362 o.commit()
363 o2 = bleachbit.Options.Options()
364 self.assertEqual(
365 o2.get('test_key', section='test_section'), 'original_value')
366 o2.close()
367
368 # Clean up
369 o.reset_overrides()
370 if o.config.has_section('test_section'):
371 o.config.remove_section('test_section')
372
373 def test_flush_mechanisms_timer_and_close(self):
374 """Test that changes flush correctly via timer fire or explicit close()."""

Callers

nothing calls this directly

Calls 8

getMethod · 0.95
closeMethod · 0.95
add_sectionMethod · 0.80
set_overrideMethod · 0.80
commitMethod · 0.80
reset_overridesMethod · 0.80
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected