Commit Graph

63 Commits

Author SHA1 Message Date
Davide Brunato b7b6fef418 Base modules refactoring for fix ElementTree import 2019-10-07 15:31:18 +02:00
Davide Brunato 7b5a2b9d6d Removed unmap_prefixed() from NamespaceMapper
- Added an optional name table to unmap_qname() for the lookup
    of local names
  - Fix lxml encoding tests in case of default namespace
2019-08-27 10:58:32 +02:00
Davide Brunato 74a45b9010 Refactoring test scripts
- Created test_factory subpackage
  - Avoid test discovery duplications
  - Added tests into test_cases dir for default discover
  - Grouped validation and validators tests in two dirs
2019-08-17 17:47:19 +02:00
Davide Brunato 657e1c16f0 Split tests of schemas and validators to subpackages
- This is a premise for expanding basic test cases on schemas,
    validation, decoding and encoding.
2019-07-16 09:45:54 +02:00
Davide Brunato 6994da5173 Code refactoring for tests
- Rename XMLSchemaTestCase to XsdValidatorTestCase
  - Add casepath() helper
  - Modify TestResources: derive from TestCase and use casepath()
  - Split test_package.py into 3 modules (added test_etree.py and
    test_memory.py)
  - Update .tox with new environments 'package' and 'memory'
  - Replace test_package with test_etree into test_all.py script
  - Modify XsdValidatorTestCase.check_schema() to use xs prefix for
    XSD namespace and no namespace as targetNamespace for a fast
    reuse of common and user sample cases
2019-06-20 15:35:04 +02:00
Davide Brunato d21ac11dde Fix default values decoding as reported by issue #108
- Default and fixed values are inserted during the decode or
    encode process
  - Update tox.ini to include coverage and flake8 to environments
    and an optional environment to build source and wheel packages
2019-05-31 09:29:41 +02:00
Davide Brunato 4c3ca4b53c Enable skipped schema tests on models 2019-04-06 14:31:06 +02:00
Davide Brunato 58af73dd1b Refine checks on models and restrictions 2019-04-04 09:06:46 +02:00
Davide Brunato 92450894dc Update test scripts
- Now SchemaObserver component is compared against maps components
  - Improved error message for XMLSchemaTestCase.check_errors()
2019-03-12 07:14:41 +01:00
Davide Brunato ebe368166d Code cleaning on XMLSchemaTestCase classes 2019-02-09 09:26:34 +01:00
Davide Brunato bbbbbe0873 Add override tag and XMLSchema11._include_schema() 2019-02-08 23:28:49 +01:00
Davide Brunato 62c08282c3 Update XMLSchemaTestCase
- cls.abspath() replaced by cls.casepath()
2019-02-02 11:23:37 +01:00
Davide Brunato 5f10fe67a7 Code cleaning of test scripts
- Removed old code of xmlschema imports
  - Test header enriched with Python version and platform
2019-01-31 22:09:18 +01:00
Davide Brunato 9d6b88baae Change copyright years info 2019-01-20 16:56:10 +01:00
Davide Brunato ca47623dba Update MANIFEST.in template and tests
- Now MANIFEST.in includes package data inclusions
    and exclusions
  - Clean test subpackage
  - Test factory moved to a separated module
  - Add a factory argument for checking with lxml
  - SchemaObserver moved to a separated module
  - Test factory now can creates tests for XMLSchema11 class
2018-12-27 19:20:04 +01:00
Davide Brunato bd90cacc7a QNames refactoring
- Moved all QNames to the same module
  - Create module helpers.py that includes XSD parse utils and name
    manipulation helper functions
2018-10-08 23:47:18 +02:00
Davide Brunato c790838d13 Move XSD builtin QNames to qnames.py module 2018-10-08 15:32:50 +02:00
Davide Brunato ad5e4debb6 Add re.compile patterns to parseutils internal API
- RE_ISO_TIMEZONE changed to accept only [-14:00, 14:00]
  - Added XsdExplicitTimezoneFacet
2018-10-07 09:49:02 +02:00
Davide Brunato 5133df5a75 Implement test for get_xsd_annotation helper function 2018-09-28 21:24:33 +02:00
Davide Brunato 33c8e881bb Protect simple types lookups and base type building
- Added check_namespace_prefixes() test helper to XMLSchemaTestCase
  - Added namespace ckecks to encoded trees and errors
  - Update CHANGELOG.rst
2018-09-27 18:26:26 +02:00
Davide Brunato a7f5c41a85 Fix regex module
- Added several tests
  - Fixed start and end expression in regex.get_python_regex():
    now puts '^(' and ')$' instead of '^' and '$'.
  - Fixed '.' conversion in regex.get_python_regex(): raw string
    qualifier removed from string literal.
2018-09-22 15:26:00 +02:00
Davide Brunato 8e8f53ecb9 Update validator exceptions and test modules
- Add test_helpers.py module
  - Refactoring of chidren validation error's reason build
  - Removed unused qname helper functions (split_*)
  - Fix case collection missing files (logger.error message)
2018-09-15 16:56:43 +02:00
Davide Brunato 5a92df7315 Fix XsdModelValidator
- Now uses also ParticleMixin.is_emptiable() instead of "not min_occurs"
  - New methods is_missing() and is_over() for ParticleMixin
2018-08-23 07:27:15 +02:00
Davide Brunato 876622e9e9 Added XMLSchema11 class for development 2018-08-09 07:10:39 +02:00
Davide Brunato f1839b592f Add XsdGroup.is_needless method
- TODO: fix for XsdGroup.is_restriction and .iter_group methods
2018-07-14 11:14:08 +02:00
Davide Brunato 80c200f651 Add is_etree_element helper function
- This is a more safer test for Element objects for this package, because it
    also checks that the argument is not an instance of ElementPathMixin class
  - Add tests for fetch_schema_locations and load_xml_resource functions
2018-07-13 22:40:35 +02:00
Davide Brunato 684558794e Resource api normalize_url rewritten
- Now uses os.path.join for all URLs related to files, without
    mess up relative paths.
  - Added keep_relative=False optional argument.
2018-07-13 12:53:34 +02:00
Davide Brunato dd43288abd Update test case parser for release
- "--defaults" option removed (cases merged within --skip)
  - "--baseurl" removed (useless, the cases are all URL-based)
2018-07-12 17:32:36 +02:00
Davide Brunato e06e5571a0 Fix resource locations processing for namespace imports
- Added copy(), __repr__ and __str__ to XMLResource class.
  - Fixed XMLResource.get_locations(): now accepts also locations
    already stored into a NamespaceResourcesMap dictionary.
  - XMLSchema.iter_decode now always creates an XMLResource from
    the source argument.
  - Fix for XMLSchema.built property: has to count all namespace globals.
2018-07-11 14:13:23 +02:00
Davide Brunato afa7299a72 Written XMLResource.get_locations() method 2018-07-10 15:02:07 +02:00
Davide Brunato dc87c4ef61 Added fetch_namespaces() to resource API
- etree_get_namespaces() removed from etree.py but left in module
    as alias of fetch_namespaces for back compatibility.
2018-07-10 12:41:39 +02:00
Davide Brunato 93a8d3068d Replace allow_overrides tentative with base_dir 2018-07-09 15:11:47 +02:00
Davide Brunato f3c73d28ca Add allow_overrides to schema init arguments and add documents.py
- Import schemaLocation attribute can be overriden
  - Re-added the --network flag to test factory arguments to skip
    tests that fail if network access is not available
  - Code cleaning: added documents.py for all module level API
2018-07-09 10:45:06 +02:00
Davide Brunato 3285f32b8a Fix test factory arguments helper 2018-07-07 23:26:41 +02:00
Davide Brunato 3e6ce18ae4 Rewritten includes and imports for schema initialization
- Now a warning message is sent to the logger for include or
    for namespace import errors
  - Add XMLSchemaImportWarning and XMLSchemaIncludeWarning
  - Add warning attribute to schemas for collecting the message
    strings about include and import warnings
  - URIDict class removed (faulty with empty fragment #)
  - Added --warning and --timeout to test factory arguments
  - Removed --network from test factory arguments
2018-07-07 11:25:00 +02:00
Davide Brunato f5b375ffbe Test factory options revised and add --network option 2018-07-06 09:39:44 +02:00
Davide Brunato e3bf188413 Add 'timeout' argument to schema and 'defuse' and 'timeout' to resource API 2018-07-05 12:30:57 +02:00
Davide Brunato fe9040e258 Implement lossless and losslessly properties for converters 2018-07-05 09:33:49 +02:00
Davide Brunato e9027604d2 Switch testfiles verbose arguments to use -- prefix 2018-07-04 06:50:27 +02:00
Davide Brunato 645c89a445 Fix lxml imports in etree.py and add -debug test option for testfiles 2018-07-03 19:07:34 +02:00
Davide Brunato 375005a860 Fix for issue #71
- Added 'mixed' keyword argument in case of empty content
  - Validator tests: refined trees comparison in check_etree_encode()
2018-07-03 06:52:35 +02:00
Davide Brunato 4e651fd292 TestValidator<NNN> classes now are based on a class closure 2018-07-02 15:15:20 +02:00
Davide Brunato 58246fd8f3 Add a test for json file serialization (test_json_dump_and_load) 2018-06-28 16:33:02 +02:00
Davide Brunato 4128f21548 Improve converters and namespace decoding
- Fixed NamespaceMapper base class
  - Added level=0 argument to XMLSchemaConverter.element_decode()
2018-06-27 15:06:14 +02:00
Davide Brunato abad6fa9e6 Modified XMLSchemaConverter.element_encode()
- The method now uses xsd_element.type
  - Add is_list() to simple type classes
2018-06-20 11:55:53 +02:00
Davide Brunato 7d9a2245f6 Full metaclass implementation for schemas
- create_validator() helper function removed
  - added add_metaclass decorator (from six)
  - XMLSchemaBase now has XMLSchemaMeta as metaclass
2018-06-18 17:24:14 +02:00
Davide Brunato 47492aa788 Added TAG_MAP to schemas for lookup functions 2018-06-18 11:18:14 +02:00
Davide Brunato 1ec3ef1cc6 First implementation of iter_encode()
- Almost a final form of the encode API
  - Added first tests in test_encoding.py
2018-06-07 15:17:05 +02:00
Davide Brunato 02e4c7aa20 Fix for issue #67 (union restriction admitted facets)
- Fixed UNION_FACETS to {pattern, enumeration, assertion}
  - Added a test file (cases/features/model/recursive-groups.xsd)
  - Added a test for issue #67
2018-06-07 07:10:05 +02:00
Davide Brunato df30a78288 Fix ValidatorMixin API arguments
- iter_decode() and iter_encode() now have only common arguments
    plus *args and **kwargs.
  - Test package: rename get_schema_source() to retrieve_schema()
    to avoid confusion about its usage.
2018-06-06 14:53:58 +02:00