summaryrefslogtreecommitdiff
path: root/docutils/test/test_language.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix IndexError when running individual test modules under Python <3.9milde2022-11-261-1/+1
| | | | | | | | | Up to Python 3.8, __file__ returns a relative path for the main script specified on the command line. Use `Path.resolve()` to make it absolute before calling `Path.parents`. https://docs.python.org/3/whatsnew/3.9.html#other-language-changes git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9277 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix import errors with ``python -m unittest``.milde2022-11-251-2/+3
| | | | | | | | Running standard unittest on the test suite resulted in 89 ImportErrors because ``import DocutilsTestSupport was used to set up sys.path() but the module could not be found on the original sys.path(). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9274 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix running of individual test (first batch).milde2022-11-241-0/+7
| | | | | | | | | | | | | | | | | | After test refactoring, test scripts failed with ImportError unless started from the "test root" ``docutils/test/``. Prepend the "docutils root" to the Python library path so we import the local `docutils` and `test` packages, ignoring an eventually installed Docutils package. Set executable bit where this was missing. Also: Use "pathlib" instead of "os.path" for self-documenting path manipulations. Remove duplicate ``import unittest`` statements. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9263 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Refactor ``test_language``aa-turner2022-10-281-199/+85
| | | | | | | - Use subtests - Use standard ``unittest`` assert methods git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9183 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Prepare switch from optparse to argparse.milde2022-03-171-1/+1
| | | | | | | | | | | | | New interface function: frontend.get_default_settings() easy access to default settings for programmatic use. Add deprecation warnings. Catch them when accessing the deprecated functions from Docutils. Make docstrings conform to the Documentation Policies (first line: summary, next line empty). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9047 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove unused local variablesmilde2022-03-051-3/+1
| | | | | | | | flake rule F841: local variable 'foo' is assigned to but never used In test_odt.py, a no-op class definition is removed completely. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9038 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove unused imports.milde2022-03-051-1/+1
| | | | | | flake8 rule F401 git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9037 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix imports.milde2022-03-051-1/+3
| | | | | | | | flake8 rules E401: multiple imports on one line E402: module level import not at top of file git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9027 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Ensure 2 blank lines around top-level functions and classes.milde2022-03-041-0/+3
| | | | | | | | flake8 rules E302: expected 2 blank lines, found 1 E305: expected 2 blank lines after class or function definition git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9026 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Ensure comments start with '# 'milde2022-03-041-2/+2
| | | | | | | | | | | flake rules E262: inline comment should start with '# ' E265: block comment should start with '# ' E266: too many leading '#' for block comment Exception for latex2e (legacy convention to mark disabled code with ##). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9022 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Ensure at least two spaces before inline comment.milde2022-03-041-1/+1
| | | | | | | | | flake 8 rule E261 Exceptions for modules sheduled for removal or with 3rd-party origin and for data collections. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9021 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix multiple spaces before/after operatormilde2022-03-031-1/+1
| | | | | | | E221 multiple spaces before operator E222 multiple spaces after operator git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9016 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove redundant parenthesesmilde2022-01-261-1/+1
| | | | | | Patch by Adam Turner. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8976 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Small fixes and clean-ups by Adam Turner.milde2022-01-261-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Remove duplicate definitions in language modules. Import locale_encoding from `docutils.io` Use decorator for staticmethod Use True/False over 1/0. `collections.OrderedDict` no longer required, all dictionaries are ordered from Python 3.7 Remove obsolete `__cmp__` method cf. https://docs.python.org/3/whatsnew/3.0.html#ordering-comparisons Use str instead of type(''). Zero-argument ``super()`` Simplify test support module as "u" prefix isn't used by repr in Python 3. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8973 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Document incompatibility with "pytest" and "nosetest". Update.milde2022-01-121-4/+14
| | | | | | | | | Triggered by [feature-request:#81]. Use PEP 3102 syntax instead of reading/deleting "**kwargs" items for "required keyword arguments". git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8945 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Drop special-casing for Python 2.x in tests and tools.milde2022-01-031-6/+3
| | | | | | | Use "python3" in the shebang line (cf. PEP 394 -- The "python" Command on Unix-Like Systems). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8927 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* py3: Wrap 'foo.keys()', 'zip(foo, bar') in 'list'milde2019-08-271-1/+1
| | | | | | | | | | | In Python 3, 'dict.keys()', 'zip' and 'map' no longer return a list but rather types 'dict_keys', 'zip' and 'map', respectively. You can't append to these types nor can you delete from them while in a loop. The simple solution to both issues is to wrap things in 'list'. Signed-off-by: Stephen Finucane <stephen@that.guru> git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8372 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Formatting changes to facilitate integration of "py3" patchset.milde2019-08-271-1/+1
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8367 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Consistent Python 3 checks.milde2019-08-261-1/+1
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8360 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* py3: Use 'sorted(foo)' instead of 'foo.sort()'milde2019-08-261-4/+2
| | | | | | | | This works with iterators also (like 'dict.keys()' in Python 3) Signed-off-by: Stephen Finucane <stephen@that.guru> git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8357 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* py3: Add aliases for removed symbolsmilde2019-08-261-2/+5
| | | | | | | | | | Add aliases for symbols that have been removed in Python 3.x, namely basestring, unicode, unichr and StandardError. Signed-off-by: Stephen Finucane <stephen@that.guru> small fixes by Günter Milde. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8348 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* py3: Switch to 'except foo as bar' syntaxmilde2019-08-261-2/+2
| | | | | | | | This is the only form supported in Python 3.x. Signed-off-by: Stephen Finucane <stephen@that.guru> git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8347 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix: (in regex) py38 SyntaxWarning: invalid escape sequence \grubert2019-08-101-1/+1
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8310 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix [3559988] and [3560841] __import__ local writer, reader, languages and ↵grubert2012-08-261-0/+5
| | | | | | parsers for Python 2.7 up. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@7503 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Do not fail, if the specified langauage is not supported by Docutils,milde2010-09-281-6/+10
| | | | | | | warn and fall back to English. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@6433 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Handle language codes according to BCP 47 milde2010-09-171-1/+3
| | | | | | | | | | | | | (Best Current Praxis: Tags for Identifying Languages). Normalize language tags: downcase, - to _, optional subtags. E.g. Given "de-AT-1901", look for language modules "de_at_1901", "de_at", "de_1901", and "de" TODO: warn (instead of fail), if no module found. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@6423 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Prepare for python 3.0: minimize "types" module where possible (gbrandl).grubert2008-11-301-3/+2
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5738 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Merged abolish-userstring-haskey r5609:5616 to trunk.strank2008-07-281-4/+4
| | | | | | Backwards compatible changes for easier transition to py3.0. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5618 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* undo accidental commit to trunkstrank2008-07-231-4/+4
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5608 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Replace all has_key with the in operator.strank2008-07-231-4/+4
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5607 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* reverted r5032; breaks Python 2.2 compatibilitywiemann2007-03-211-2/+2
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5033 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* replaced 'raw_unicode_escape' with 'ascii', 'backslashreplace' so we don't ↵wiemann2007-03-211-2/+2
| | | | | | get latin1 strings git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5032 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* use $Id$ instead of $Date$ and $Revision$;wiemann2006-05-211-4/+3
| | | | | | | | collapsed Author and Contact fields; use canonical email addresses for David and Felix; (I have reviewed the diff) git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@4564 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* corrected order of importsgoodger2005-12-031-5/+6
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@4132 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* set executable bits on test fileswiemann2005-03-221-0/+0
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@3085 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* updatedgoodger2004-04-161-2/+2
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@1949 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* updatedgoodger2004-04-161-3/+3
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@1945 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* added tests for bibliographic fields and rolesgoodger2003-06-281-10/+66
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@1517 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* updatedgoodger2002-12-051-2/+5
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@994 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* updatedgoodger2002-11-141-7/+18
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@949 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* + fix directive checking.grubert2002-11-131-0/+3
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@945 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Adapted to DocutilsTestSupport.pygoodger2002-11-131-68/+100
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@942 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Tests for language modules completeness. By Engelbert Gruber.goodger2002-11-131-0/+105
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@940 929543f6-e4f2-0310-98a6-ba3bd3dd1d04