#! /usr/bin/env python # $Id: test_enumerated_lists.py 5033 2007-03-21 19:51:22Z wiemann $ # Author: David Goodger # Copyright: This module has been placed in the public domain. """ Tests for states.py. """ from .__init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['enumerated_lists'] = [ ["""\ 1. Item one. 2. Item two. 3. Item three. """, """\ Item one. Item two. Item three. """], ["""\ No blank lines betwen items: 1. Item one. 2. Item two. 3. Item three. """, """\ No blank lines betwen items: Item one. Item two. Item three. """], ["""\ 1. empty item above, no blank line """, """\ 1. empty item above, no blank line """], ["""\ Scrambled: 3. Item three. 2. Item two. 1. Item one. 3. Item three. 2. Item two. 1. Item one. """, """\ Scrambled: Item three. Enumerated list start value not ordinal-1: "3" (ordinal 3) Item two. Enumerated list start value not ordinal-1: "2" (ordinal 2) Item one. 3. Item three. 2. Item two. 1. Item one. """], ["""\ Skipping item 3: 1. Item 1. 2. Item 2. 4. Item 4. """, """\ Skipping item 3: Item 1. Enumerated list ends without a blank line; unexpected unindent. 2. Item 2. 4. Item 4. """], ["""\ Start with non-ordinal-1: 0. Item zero. 1. Item one. 2. Item two. 3. Item three. And again: 2. Item two. 3. Item three. """, """\ Start with non-ordinal-1: Item zero. Item one. Item two. Item three. Enumerated list start value not ordinal-1: "0" (ordinal 0) And again: Item two. Item three. Enumerated list start value not ordinal-1: "2" (ordinal 2) """], ["""\ 1. Item one: line 1, line 2. 2. Item two: line 1, line 2. 3. Item three: paragraph 1, line 1, line 2. Paragraph 2. """, """\ Item one: line 1, line 2. Item two: line 1, line 2. Item three: paragraph 1, line 1, line 2. Paragraph 2. """], ["""\ Different enumeration sequences: 1. Item 1. 2. Item 2. 3. Item 3. A. Item A. B. Item B. C. Item C. a. Item a. b. Item b. c. Item c. I. Item I. II. Item II. III. Item III. i. Item i. ii. Item ii. iii. Item iii. """, """\ Different enumeration sequences: Item 1. Item 2. Item 3. Item A. Item B. Item C. Item a. Item b. Item c. Item I. Item II. Item III. Item i. Item ii. Item iii. """], ["""\ Bad Roman numerals: i. i ii. ii iii. iii iiii. iiii second line (LCD) is an acronym made up of Roman numerals (livid) is a word made up of Roman numerals (CIVIL) is another such word (I) I (IVXLCDM) IVXLCDM """, """\ Bad Roman numerals: i ii iii iiii. iiii second line (LCD) is an acronym made up of Roman numerals (livid) is a word made up of Roman numerals (CIVIL) is another such word I (IVXLCDM) IVXLCDM """], ["""\ Potentially ambiguous cases: A. Item A. B. Item B. C. Item C. I. Item I. II. Item II. III. Item III. a. Item a. b. Item b. c. Item c. i. Item i. ii. Item ii. iii. Item iii. Phew! Safe! """, """\ Potentially ambiguous cases: Item A. Item B. Item C. Item I. Item II. Item III. Item a. Item b. Item c. Item i. Item ii. Item iii. Phew! Safe! """], ["""\ Definitely ambiguous: A. Item A. B. Item B. C. Item C. D. Item D. E. Item E. F. Item F. G. Item G. H. Item H. I. Item I. II. Item II. III. Item III. a. Item a. b. Item b. c. Item c. d. Item d. e. Item e. f. Item f. g. Item g. h. Item h. i. Item i. ii. Item ii. iii. Item iii. """, """\ Definitely ambiguous: Item A. Item B. Item C. Item D. Item E. Item F. Item G. Item H. Enumerated list ends without a blank line; unexpected unindent. Item I. Item II. Item III. Item a. Item b. Item c. Item d. Item e. Item f. Item g. Item h. Enumerated list ends without a blank line; unexpected unindent. Item i. Item ii. Item iii. """], ["""\ Different enumeration formats: 1. Item 1. 2. Item 2. 3. Item 3. 1) Item 1). 2) Item 2). 3) Item 3). (1) Item (1). (2) Item (2). (3) Item (3). """, """\ Different enumeration formats: Item 1. Item 2. Item 3. Item 1). Item 2). Item 3). Item (1). Item (2). Item (3). """], ["""\ Nested enumerated lists: 1. Item 1. A) Item A). B) Item B). C) Item C). 2. Item 2. (a) Item (a). I) Item I). II) Item II). III) Item III). (b) Item (b). (c) Item (c). (i) Item (i). (ii) Item (ii). (iii) Item (iii). 3. Item 3. """, """\ Nested enumerated lists: Item 1. Item A). Item B). Item C). Item 2. Item (a). Item I). Item II). Item III). Item (b). Item (c). Item (i). Item (ii). Item (iii). Item 3. """], ["""\ A. Einstein was a great influence on B. Physicist, who was a colleague of C. Chemist. They all worked in Princeton, NJ. Using a non-breaking space as a workaround: A.\u00a0Einstein was a great influence on B. Physicist, who was a colleague of C. Chemist. They all worked in Princeton, NJ. """, """\ Einstein was a great influence on Physicist, who was a colleague of Enumerated list ends without a blank line; unexpected unindent. C. Chemist. They all worked in Princeton, NJ. Using a non-breaking space as a workaround: A.\xa0Einstein was a great influence on B. Physicist, who was a colleague of C. Chemist. They all worked in Princeton, NJ. """], ["""\ 1. Item one: line 1, line 2. 2. Item two: line 1, line 2. 3. Item three: paragraph 1, line 1, line 2. Paragraph 2. """, """\ Item one: line 1, line 2. Item two: line 1, Enumerated list ends without a blank line; unexpected unindent. line 2. Block quote ends without a blank line; unexpected unindent. Item three: paragraph 1, line 1, Enumerated list start value not ordinal-1: "3" (ordinal 3) Enumerated list ends without a blank line; unexpected unindent. line 2. Paragraph 2. """], ["""\ 1. Item one. #. Item two. #. Item three. """, """\ Item one. Item two. Item three. """], ["""\ a. Item one. #. Item two. #. Item three. """, """\ Item one. Item two. Item three. """], ["""\ i. Item one. ii. Item two. #. Item three. """, """\ Item one. Item two. Item three. """], ["""\ #. Item one. #. Item two. #. Item three. """, """\ Item one. Item two. Item three. """], ["""\ 1. Item one. #. Item two. 3. Item three. """, """\ Item one. Enumerated list ends without a blank line; unexpected unindent. #. Item two. 3. Item three. """], ["""\ z. x """, """\ z. x """], ["""\ 3-space indent, with a trailing space: 1. \n\ foo 3-space indent, no trailing space: 1. foo 2-space indent: 1. foo 1-space indent: 1. foo 0-space indent, not a list item: 1. foo No item content: 1. """, """\ 3-space indent, with a trailing space: foo 3-space indent, no trailing space: foo 2-space indent: foo 1-space indent: foo 0-space indent, not a list item: 1. foo No item content: """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite')