def test_remove_empty_iter_elements(self): # Test with empty-elem stripping. uut = ConfParser(remove_empty_iter_elements=True) uut.parse(self.file) self.assertEqual(list(uut.get_section("EMPTY_ELEM_STRIP")["A"]), ["a", "b", "c"]) self.assertEqual(list(uut.get_section("EMPTY_ELEM_STRIP")["B"]), ["a", "d"]) self.assertEqual(list(uut.get_section("EMPTY_ELEM_STRIP")["C"]), []) # Test without stripping. uut = ConfParser(remove_empty_iter_elements=False) uut.parse(self.file) self.assertEqual(list(uut.get_section("EMPTY_ELEM_STRIP")["A"]), ["a", "b", "c"]) self.assertEqual(list(uut.get_section("EMPTY_ELEM_STRIP")["B"]), ["a", "", "", "d"]) self.assertEqual(list(uut.get_section("EMPTY_ELEM_STRIP")["C"]), ["", "", "", ""])
def test_remove_empty_iter_elements(self): # Test with empty-elem stripping. uut = ConfParser(remove_empty_iter_elements=True) uut.parse(self.file) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['A']), ['a', 'b', 'c']) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['B']), ['a', 'd']) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['C']), []) # Test without stripping. uut = ConfParser(remove_empty_iter_elements=False) uut.parse(self.file) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['A']), ['a', 'b', 'c']) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['B']), ['a', '', '', 'd']) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['C']), ['', '', '', ''])
def test_remove_empty_iter_elements(self): # Test with empty-elem stripping. uut = ConfParser(remove_empty_iter_elements=True) uut.parse(self.file) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['A']), ['a', 'b', 'c']) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['B']), ['a', 'd']) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['C']), []) # Test without stripping. uut = ConfParser(remove_empty_iter_elements=False) uut.parse(self.file) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['A']), ['a', 'b', 'c']) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['B']), ['a', '', '', 'd']) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['C']), ['', '', '', ''])
def test_remove_empty_iter_elements(self): # Test with empty-elem stripping. uut = ConfParser(remove_empty_iter_elements=True) uut.parse(self.file) self.assertEqual(list(uut.get_section("EMPTY_ELEM_STRIP")["A"]), ["a", "b", "c"]) self.assertEqual(list(uut.get_section("EMPTY_ELEM_STRIP")["B"]), ["a", "d"]) self.assertEqual(list(uut.get_section("EMPTY_ELEM_STRIP")["C"]), []) # Test without stripping. uut = ConfParser(remove_empty_iter_elements=False) uut.parse(self.file) self.assertEqual(list(uut.get_section("EMPTY_ELEM_STRIP")["A"]), ["a", "b", "c"]) self.assertEqual(list(uut.get_section("EMPTY_ELEM_STRIP")["B"]), ["a", "", "", "d"]) self.assertEqual(list(uut.get_section("EMPTY_ELEM_STRIP")["C"]), ["", "", "", ""])
def test_remove_empty_iter_elements(self): # Test with empty-elem stripping. uut = ConfParser(remove_empty_iter_elements=True) isnotdir = mock.Mock(return_value=False) with mock.patch('os.path.isdir', isnotdir): uut.parse(self.file) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['A']), ['a', 'b', 'c']) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['B']), ['a', 'd']) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['C']), []) # Test without stripping. uut = ConfParser(remove_empty_iter_elements=False) with mock.patch('os.path.isdir', isnotdir): uut.parse(self.file) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['A']), ['a', 'b', 'c']) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['B']), ['a', '', '', 'd']) self.assertEqual(list(uut.get_section('EMPTY_ELEM_STRIP')['C']), ['', '', '', ''])