summaryrefslogtreecommitdiff
path: root/docutils/test/test_utils.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix test case under Windows, add HISTORY entry for last commit.milde2023-01-171-7/+8
| | | | | | Thanks to Alan Isaac for test and report. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9323 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Use pathlib.Path in utils.find_file_in_dirs().milde2022-11-281-7/+4
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9283 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* 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
* Use "pathlib.Path" for self-documenting path manipulations.milde2022-11-241-11/+16
| | | | | | | | Also, use Unicode literals for Umlauts. Signed-off-by: milde <milde@users.sf.net> git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9268 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* New function utils.xml_declaration()milde2022-11-131-0/+18
| | | | | | | | | Return XML text declaration. Include an encoding declaration if the intended encoding is known. Used in XML (and soon also in HTML) writer. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9239 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Make the tests agnostic to the working directoryaa-turner2022-11-101-5/+13
| | | | | | | | | | | Previously, the test suite only worked when the current working directory was ``docutils/test/`. With this change all relative paths are calculated explicitly such that the working directory no longer affects the tests, meaning a less fragile test environment and greater flexibility to use test runners other than ``alltests.py``. This is part of the test suite refactoring project. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9236 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Import from the ``docutils`` packageaa-turner2022-10-211-3/+3
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9146 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Avoid too long lines.milde2022-03-051-1/+2
| | | | | | flake8 rule E501: line too long (N > 79 characters) git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9030 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Ensure 2 blank lines around top-level functions and classes.milde2022-03-041-0/+1
| | | | | | | | 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
* Remove excess blank lines.milde2022-03-041-3/+0
| | | | | | flakei rule E303: too many blank lines (N) git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9025 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Ensure at least two spaces before inline comment.milde2022-03-041-3/+3
| | | | | | | | | 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
* Simplify/modernise tests for exceptions and warnings.milde2022-02-211-35/+31
| | | | | | | | | | Use unicode.assertWarnsRegex() instead of "hand written" warnings catching. Use unicode.assertRaises() as context manager (unless this would mean an additional code line). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9011 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix code indentationmilde2022-01-291-6/+6
| | | | | | | | | | | | | | | | | | | | Check conformance to our coding policies with flake8. Fix the following problems: E111 indentation is not a multiple of four E114 indentation is not a multiple of four (comment) E115 expected an indented block (comment) E116 unexpected indentation (comment) E117 over-indented E121 continuation line under-indented for hanging indent E122 continuation line missing indentation or outdented E124 closing bracked does not match visual indentaion E127 continuation line over-indented for visual indent E128 continuation line under-indented for visual indent E131 continuation line unaligned for hanging indent git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8994 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Drop string prefix "u".milde2022-01-261-23/+23
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8983 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Small fixes and clean-ups by Adam Turner.milde2022-01-261-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Deprecate `nodes.reprunicode` and `nodes.ensure_str()`.milde2022-01-041-1/+1
| | | | | | Drop uses of the deprecated constructs (not required with Python 3). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8931 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Drop special-casing for Python 2.x in tests and tools.milde2022-01-031-8/+4
| | | | | | | 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
* Fixup for [rr8892]milde2021-11-211-2/+6
| | | | | | | Skip equality test for utils.decode_path() if the `bytes` test sample cannot be encoded in the file system encoding. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8899 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fixup for [r8891]. Fix bug #434.milde2021-11-181-3/+4
| | | | | | | | | utils.get_stylesheet_list() must return POSIX paths. Don't use hard-coded Windows drive letters in the tests. Fix `bytes` test sample for utils.decode_path(). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8892 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix behaviour of get_stylesheet_list()milde2021-11-171-1/+32
| | | | | | | Do not look up stylesheets given as "stylesheet" setting. Cf. bug #434. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8891 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Test the fix for #395.milde2020-07-181-0/+14
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8529 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Minor formatting updates.milde2020-02-061-3/+3
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8482 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* add error messagegrubert2020-01-121-1/+1
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8459 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* py3: Handle 'StringIO' to 'io' transition.milde2019-08-271-1/+6
| | | | | | | | | This isn't so much a rename as a migration, since things don't do the same thing. Based on patch by: Stephen Finucane <stephen@that.guru> git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8368 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* py3: Switch to 'except foo as bar' syntaxmilde2019-08-261-1/+1
| | | | | | | | 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
* Drop support for Python 3.3milde2019-08-261-6/+3
| | | | | | | | | | This doesn't involve a whole lot of changes, but references to Python 3.3 (plus some to the already removed Python 2.6) are removed and 'setup.py' is updated as necessary. Signed-off-by: Stephen Finucane <stephen@that.guru> git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8338 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Small comment/doc fixes.milde2019-08-211-0/+3
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8331 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* DocInfo transform must not use "rawsource" attribute for escaping.milde2018-11-201-4/+0
| | | | | | | | | | | Remove implementation of escaping author-separators in bibliographic fields that relies on the "rawsource" attribute. This is not safe (rawsource is only for information and debugging purposes). A proper fix can be done with null-escaped text in the doctree. C.f. https://sourceforge.net/p/docutils/bugs/_discuss/thread/c8f86be6/74ed/attachment/null-escape-in-doctree2.patch git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8231 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Move tests for (un)escaping functions to test_utils.milde2017-11-061-9/+12
| | | | | | The functions moved in 0.3.7 (2004-12-24). git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8199 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* New function `utils.unescape_rawsource`.milde2017-11-041-0/+16
| | | | | | | | | Removes backslashes and backslash-escaped whitespace from `rawsource` arguments. Required for fixes in definition list terms, author docinfo extraction, and smartquote escaping. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8195 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* * Consolidated version identifier documentation, moving text from ↵goodger2017-08-151-1/+6
| | | | | | | | | | docutils/__init__.py to docs/dev/policies.txt. * Cleaned up version-related code in docutils/__init__.py. * Reworked the Version Numbering section in docs/dev/policies.txt. * Added test/test_utils.HelperFunctionTests.test_implicit_version_identifier to test the implicit use of docutils.utils.version_identifier(). git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8167 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* * Consolidated version numbering documentation in docs/dev/policies.txt ↵goodger2017-08-141-8/+13
| | | | | | | | | | (moved text from docs/dev/release.txt). * Updated docutils.utils.version_identifier for Python 2.6 (docutils.VersionInfo). * Moved code from tests/test/test_utils.py::HelperFunctionsTests.test_version_identifier to tests/test__init__.py::VersionInfoTests.test_version_identifier; uncommented lines in tests/test__init__.py::VersionInfoTests.test_version_info. * Added new tests/test/test_utils.py::HelperFunctionsTests.test_version_identifier. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8165 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* added docutils.utils.version_identifier() and a testgoodger2017-07-081-2/+9
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8141 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* hack around find files on windows , path with backslashgrubert2014-07-081-3/+6
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@7771 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* HACK around tests that depend on directory contents.grubert2014-07-061-1/+2
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@7767 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* New setting `stylesheet_dirs`.milde2013-03-021-0/+13
| | | | | | | | | | | | | | | | Comma-separated list of directories where stylesheets are found. Used by `stylesheet_path` when expanding relative path arguments. Now, it is easy to add a custom stylesheet to Docutils default stylesheet with, e.g., --stylesheet_path="html4css1.css, mystyle.css" Changed behaviour of the default settings: if there is a file "html4css1.css" in the working directory of the process at launch, it is used instead of the one provided by Docutils in the writer source directory. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@7618 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* normalize_language_tag() now returns `BCP 47`_ conformant tagsmilde2012-11-231-4/+7
| | | | | | Subtags separated by ``-``, not ``_``. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@7538 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix relative_path() with source=None and `unicode` target.milde2012-02-031-0/+32
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@7338 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Replace deprecated aliases for assert methods with correct names.milde2012-02-031-31/+32
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@7337 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* docutils.utils is now a package (providing a place for sub-modules)milde2011-12-201-1/+1
| | | | | | | | | important:: docutils/math, docutils/error_reporting.py, and docutils/urischemes.py will move to the utils package in the next release, too. Code importing these modules needs to adapt. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@7267 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Workaround for unicode messages in Exception instances with Python < 2.6.milde2011-04-121-3/+25
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@7007 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Minor fixes for Python 3.1milde2011-01-031-1/+1
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@6509 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* exclude combining chars from column_width (partial fix for [ 2926161 ])milde2010-11-101-0/+6
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@6476 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Handle language codes according to BCP 47 milde2010-09-171-0/+13
| | | | | | | | | | | | | (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
* Fix py3k problem: sys.stderr expects a unicode string.milde2010-03-221-17/+19
| | | | | | | In Python 3, text output auto-encodes the given string and fails if given an already encoded (i.e. binary) string. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@6271 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Convert docutils to Python 3 (at least so that it runs the test suite.)gbrandl2009-04-011-16/+16
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5889 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Merged abolish-userstring-haskey r5609:5616 to trunk.strank2008-07-281-2/+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
* use $Id$ instead of $Date$ and $Revision$;wiemann2006-05-211-4/+2
| | | | | | | | 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
* merged reporter-categories branch into trunk: removed ↵goodger2005-04-051-81/+0
| | | | | | docutils.utils.Reporter.categories, docutils.utils.ConditionSet, and all references to them, to simplify error reporting git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@3171 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* made issuing debug-system_messages conditionalwiemann2005-03-281-5/+2
| | | | git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@3143 929543f6-e4f2-0310-98a6-ba3bd3dd1d04