(self)
| 615 | cf.getboolean, 'BOOLTEST', 'e%d' % x) |
| 616 | |
| 617 | def test_weird_errors(self): |
| 618 | cf = self.newconfig() |
| 619 | cf.add_section("Foo") |
| 620 | with self.assertRaises(configparser.DuplicateSectionError) as cm: |
| 621 | cf.add_section("Foo") |
| 622 | e = cm.exception |
| 623 | self.assertEqual(str(e), "Section 'Foo' already exists") |
| 624 | self.assertEqual(e.args, ("Foo", None, None)) |
| 625 | |
| 626 | if self.strict: |
| 627 | with self.assertRaises(configparser.DuplicateSectionError) as cm: |
| 628 | cf.read_string(textwrap.dedent("""\ |
| 629 | [Foo] |
| 630 | will this be added{equals}True |
| 631 | [Bar] |
| 632 | what about this{equals}True |
| 633 | [Foo] |
| 634 | oops{equals}this won't |
| 635 | """.format(equals=self.delimiters[0])), source='<foo-bar>') |
| 636 | e = cm.exception |
| 637 | self.assertEqual(str(e), "While reading from '<foo-bar>' " |
| 638 | "[line 5]: section 'Foo' already exists") |
| 639 | self.assertEqual(e.args, ("Foo", '<foo-bar>', 5)) |
| 640 | |
| 641 | with self.assertRaises(configparser.DuplicateOptionError) as cm: |
| 642 | cf.read_dict({'Bar': {'opt': 'val', 'OPT': 'is really `opt`'}}) |
| 643 | e = cm.exception |
| 644 | self.assertEqual(str(e), "While reading from '<dict>': option " |
| 645 | "'opt' in section 'Bar' already exists") |
| 646 | self.assertEqual(e.args, ("Bar", "opt", "<dict>", None)) |
| 647 | |
| 648 | def test_get_after_duplicate_option_error(self): |
| 649 | cf = self.newconfig() |
nothing calls this directly
no test coverage detected