(cls, dialect)
| 527 | |
| 528 | @classmethod |
| 529 | def validate(cls, dialect): |
| 530 | dialect = cls.extend(dialect) |
| 531 | |
| 532 | if not isinstance(dialect.quoting, int): |
| 533 | raise Error('"quoting" must be an integer') |
| 534 | |
| 535 | if dialect.delimiter is None: |
| 536 | raise Error('delimiter must be set') |
| 537 | cls.validate_text(dialect, 'delimiter') |
| 538 | |
| 539 | if dialect.lineterminator is None: |
| 540 | raise Error('lineterminator must be set') |
| 541 | if not isinstance(dialect.lineterminator, str): |
| 542 | raise Error('"lineterminator" must be a string') |
| 543 | |
| 544 | if dialect.quoting not in [ |
| 545 | QUOTE_NONE, QUOTE_MINIMAL, QUOTE_NONNUMERIC, QUOTE_ALL]: |
| 546 | raise Error('Invalid quoting specified') |
| 547 | |
| 548 | if dialect.quoting != QUOTE_NONE: |
| 549 | if dialect.quotechar is None and dialect.escapechar is None: |
| 550 | raise Error('quotechar must be set if quoting enabled') |
| 551 | if dialect.quotechar is not None: |
| 552 | cls.validate_text(dialect, 'quotechar') |
| 553 | |
| 554 | @staticmethod |
| 555 | def validate_text(dialect, attr): |
no test coverage detected