(self)
| 359 | """.format(self.delimiters))) |
| 360 | |
| 361 | def test_basic_from_dict(self): |
| 362 | config = { |
| 363 | "Foo Bar": { |
| 364 | "foo": "bar1", |
| 365 | }, |
| 366 | "Spacey Bar": { |
| 367 | "foo": "bar2", |
| 368 | }, |
| 369 | "Spacey Bar From The Beginning": { |
| 370 | "foo": "bar3", |
| 371 | "baz": "qwe", |
| 372 | }, |
| 373 | "Commented Bar": { |
| 374 | "foo": "bar4", |
| 375 | "baz": "qwe", |
| 376 | }, |
| 377 | "Long Line": { |
| 378 | "foo": "this line is much, much longer than my editor\nlikes " |
| 379 | "it.", |
| 380 | }, |
| 381 | "Section\\with$weird%characters[\t": { |
| 382 | }, |
| 383 | "Internationalized Stuff": { |
| 384 | "foo[bg]": "Bulgarian", |
| 385 | "foo": "Default", |
| 386 | "foo[en]": "English", |
| 387 | "foo[de]": "Deutsch", |
| 388 | }, |
| 389 | "Spaces": { |
| 390 | "key with spaces": "value", |
| 391 | "another with spaces": "splat!", |
| 392 | }, |
| 393 | "Types": { |
| 394 | "int": 42, |
| 395 | "float": 0.44, |
| 396 | "boolean": False, |
| 397 | 123: "strange but acceptable", |
| 398 | }, |
| 399 | "This One Has A ] In It": { |
| 400 | "forks": "spoons" |
| 401 | }, |
| 402 | } |
| 403 | if self.allow_no_value: |
| 404 | config.update({ |
| 405 | "NoValue": { |
| 406 | "option-without-value": None, |
| 407 | } |
| 408 | }) |
| 409 | cf = self.newconfig() |
| 410 | cf.read_dict(config) |
| 411 | self.basic_test(cf) |
| 412 | if self.strict: |
| 413 | with self.assertRaises(configparser.DuplicateSectionError): |
| 414 | cf.read_dict({ |
| 415 | '1': {'key': 'value'}, |
| 416 | 1: {'key2': 'value2'}, |
| 417 | }) |
| 418 | with self.assertRaises(configparser.DuplicateOptionError): |
nothing calls this directly
no test coverage detected