summaryrefslogtreecommitdiff
path: root/tests/scanner/annotationparser/test_parser.py
Commit message (Collapse)AuthorAgeFilesLines
* message: simplify handling of error levelsChristoph Reiter2019-01-101-2/+2
| | | | | | | | Instead of allowing each error level to be enabled just enable all of them through the enable_warnings() method. This matches what the code is currently doing (minus that one helper script) and simplifies things. Also remove the error count, it's not used.
* Drop all Python 2 compat codeChristoph Reiter2018-12-081-13/+2
| | | | We only support 3.4+ now.
* giscanner: Use unicode literals in all Python filesSimon Feltman2015-09-291-2/+9
| | | | | | | | | | | | Add unicode_literals future import which turns any string literal into a unicode string. Return unicode strings from the Python C extension module. Force writing of annotations (g-ir-annotation-tool) to output utf8 encoded data to stdout. This is an initial pass at following the "unicode sandwich" model of programming (http://nedbatchelder.com/text/unipain.html) needed for supporting Python 3. https://bugzilla.gnome.org/show_bug.cgi?id=679438
* giscanner: Use print as a function for Python 3 compatibilitySimon Feltman2015-09-291-0/+1
| | | | | | | Use future import "print_function" and update relevant uses of print as a function call. See: PEP 3105 https://bugzilla.gnome.org/show_bug.cgi?id=679438
* giscanner: Enable "true division" for all Python filesSimon Feltman2015-09-291-0/+1
| | | | | | | | | | Import Python 3 compatible "true division" from the future (PEP 238). This changes the Python 2 classic division which uses floor division on integers to true division. Verfied we don't actually use the division operator anywhere in the code base so this a safety for supporting both Python 2 and 3. https://bugzilla.gnome.org/show_bug.cgi?id=679438
* giscanner: Use absolute_import for all Python filesSimon Feltman2015-09-291-0/+1
| | | | | | Use absolute_import to ensure Python 3 compatibility of the code base. https://bugzilla.gnome.org/show_bug.cgi?id=679438
* tests: execute annotationparser tests just onceDieter Verfaillie2015-06-241-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | 42bb69a6a2f12165a9758b192e80da089e00ab5c introduced a bug causing test_parser.py and test_patterns.py tests to be executed twice. This patch fixes this and still allows the tests to be executed: - using 'make check' - manually: PYTHONPATH=. python tests/scanner/annotationparser/test_parser.py PYTHONPATH=. python tests/scanner/annotationparser/test_patterns.py - individually: python -m unittest test_parser.TestGiTag_Stability.test_001 python -m unittest test_patterns.TestCommentAsterisk.test_000 test_parser.py now results in: Ran 360 tests in 0.172s instead of: Ran 720 tests in 0.339s test_patterns.py now results in: Ran 213 tests in 0.014s instead of Ran 426 tests in 0.041s https://bugzilla.gnome.org/show_bug.cgi?id=745636
* tests: Python 3 fixesDieter Verfaillie2015-06-241-1/+1
| | | | | | | | tests/scanner/annotationparser/test_[parser|patterns].py stopped working with Python3 somewhere down the line due to the iteritems() call... https://bugzilla.gnome.org/show_bug.cgi?id=745636
* tests: Refactor test_parser and test_patterns to use unittest.TestSuiteSimon Feltman2013-12-291-6/+48
| | | | | | | | | | | | | Update both test_parser.py and test_patterns.py to dynamically generate TestCase sub-classes rather than modify a statically defined one. Use unittest.TestSuite to queue up the generated test cases via the "load_tests" hook. Use underscores instead of periods as a seperator for dynamically generated test cases and methods to match Python identifiers. Beyond general cleanup, these changes will help the ability to specify Python tests individually. https://bugzilla.gnome.org/show_bug.cgi?id=720713
* giscanner: refactor GTK-Doc comment block serializationDieter Verfaillie2013-10-081-5/+28
|
* giscanner: give parameters their own storage classDieter Verfaillie2013-10-081-2/+2
|
* giscanner: flesh out annotation parsing and storageDieter Verfaillie2013-10-081-37/+55
| | | | | | | | | | - remove annotations regex, restore proper parens parsing - drop weird DocOption() storage class and use lists/dicts as appropriate - make GtkDocAnnotations a simple OrderedDict subclass instead of a weird hybrid dict/list storage class - Deprecate Attribute: tag, replace with (attributes) annotation on the identifier
* giscanner: extract tag valuesDieter Verfaillie2013-10-081-2/+6
|
* giscanner: remove unused GtkDocCommentBlock.valueDieter Verfaillie2013-10-081-2/+2
|
* giscanner: rename DocBlock to GtkDocCommentBlockDieter Verfaillie2013-10-081-2/+2
| | | | | and move it downwards after DocTag, DocOptions etc for easier reading
* giscanner: give message.ERROR a purposeDieter Verfaillie2013-10-081-2/+2
| | | | | | | | | | | | | | | | | | | It's not yet being used but will be in the future by annotationparser.py to signal the difference between message.WARNING: something is wrong but the comment block can still be parsed and serialized back into a comment block without information being lost message.ERROR: something is wrong and the comment block can *not* be parsed and serialized back into a comment block without information being lost Different tools can then act accordingly. Nothing will change for g-ir-scanner but this will be important for the GTK-Doc comment block rewriting tool to prevent extremely broken input leading to even more broken output...
* giscanner: expand parse_comment_block() parametersDieter Verfaillie2013-10-081-1/+1
| | | | | Makes it consistent with the parse_comment_blocks() and _parse_comment_block() methods.
* giscanner: rename AnnotationParser() to GtkDocCommentBlockParser()Dieter Verfaillie2013-10-081-2/+2
| | | | | | Clarify the purpose of what up until now was know as the AnnotationParser() class, as it does more than just extracting annotations, it parses the complete GTK-Doc comment block.
* giscanner: rename "comment" to "description"Dieter Verfaillie2013-10-081-6/+6
| | | | Simply because they are called description fields on GTK-Doc parts...
* giscanner: rename "options" to "annotations"Dieter Verfaillie2013-10-081-6/+6
| | | | | | | Makes it easier to understand the difference between an annotation and an option, which are written as "(annotation option1=value1 option2=value2 ...)" in GTK-Doc comment blocks.
* tests: fix diff outputDieter Verfaillie2013-10-081-6/+3
| | | | | Empty lines do get removed or added sometimes, so make sure we see those in our diff output.
* tests: test emitted GTK-Doc parser warning messagesDieter Verfaillie2013-10-081-14/+72
|
* tests: remove manual validation codeDieter Verfaillie2013-10-081-5/+1
| | | | | We're already validating input .xml files so no need to duplicate this...
* tests: validate GTK-Doc test filesDieter Verfaillie2013-10-081-43/+70
| | | | | | | | This is more of a handy developer tool than something that is always expected to be executed as part of the test suite, so we don't add a hard dependency on xmllint. https://bugzilla.gnome.org/show_bug.cgi?id=688897
* tests: put <docblock> element inside a <parser> elementDieter Verfaillie2013-10-081-1/+1
| | | | | | | The <parser> element can then hold both the expected <docblock> parse tree and the warning/error messages emitted by the parser in a future <messages> child element.
* tests: rename <commentblock> element to <input>Dieter Verfaillie2013-10-081-2/+2
| | | | | | We'll start testing parser warning/error messages and serialized output later on so this will make it easier to see what's parser input and output...
* tests: put create_tests() below TestCommentBlock()Dieter Verfaillie2013-10-081-20/+20
| | | | closer to __main__, where it's actually used...
* tests: make parsed2tree() and expected2tree() methods of TestCommentBlock()Dieter Verfaillie2013-10-081-192/+190
|
* tests: Update misc/pep8.py to 1.4.5Dieter Verfaillie2013-05-071-1/+2
| | | | | | | | | | | | | | | | | Version in our tree is a wee bit outdated. For example, later work will introduce an utf8 encoded python source file which our old pep8.py does not yet understand (yeah, it really was *that* ancient)... Updated from: https://raw.github.com/jcrocholl/pep8/1.4.5/pep8.py Takes 552c1f1525e37a30376790151c1ba437776682c5, f941537d1c0a40f0906490ed160db6c79af572d3, 5a4afe2a77d0ff7d9fea13dd93c3304a6ca993de and a17f157e19bd6792c00321c8020dca5e5a281f45 into account... https://bugzilla.gnome.org/show_bug.cgi?id=699535
* tests/annotationparser: Drop Python API usage down to 2.6, not 2.7Colin Walters2012-12-301-8/+8
| | | | | .iterfind() is new in 2.7, but we claim 2.6 support, as I use on RHEL6.
* giscanner: add AnnotationParser testsDieter Verfaillie2012-11-281-0/+297
The tests in giscanner/annotationpatters.py only test the regular expression programs used when parsing GTK-Doc comment blocks but do not test the structure of the resulting "parse tree". This patch adds 193 GTK-Doc comment blocks and the expected results AnnotationParser should return (with it's current level of understanding of GTK-Doc comment block syntax). These are compared by tests/scanner/annotationparser/test_parser.py which complains with a diff on failure. https://bugzilla.gnome.org/show_bug.cgi?id=688897