Commit Graph

29 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 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 81849f2368 Fix path normalization and tests for Windows platform 2019-06-19 20:02:45 +02:00
Davide Brunato 9712319150 Fix issue #116 2019-06-12 09:21:37 +02:00
Davide Brunato 3157a16475 Improve tests on XML resources
- Modify TestResources.test_remote_schemas_loading() to use examples
    from GitHub repository (more responsive)
  - Added xmlschema/tests/check_etree_memory.py to check ElementTree memory
    usage for a given file
2019-06-01 15:17:07 +02:00
Davide Brunato ccfaab9479 Fix XML resource defusing
- Add XMLResource.defusing() for checking XML data
  - Now in XMLResource.parse() and fromsource() the SafeXMLParser is
    used only for defusing data
2019-02-25 13:34:52 +01:00
Davide Brunato f08aed5346 Move xmlschema/tests/resources/ into xmlschema/tests/test_cases/ 2019-02-03 14:16:48 +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 cec34eeea0 Refactor of etree.py module
- Remove SafeXMLParserError and use ElementTree.ParseError
  - PyElementTree safe APIs errors are re-raised as C mod ParseError
  - Simplify ElementTree API and XMLResource class
2019-01-25 17:55:32 +01:00
Davide Brunato 2eabc190fe Replace defusedxml dependency
- The defusedxml seems to be unmaintained and has some problems
    with the ElementTree loading
  - Replaced by a safe XMLParser that forbids entities processing
2019-01-22 17:50:13 +01:00
Davide Brunato 9d6b88baae Change copyright years info 2019-01-20 16:56:10 +01: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 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 f81fc41f33 Fix test_resources.py for Windows platform
- Fix for normalize_url to replace backslashes.
  - Created a check_url method for TestResources class.
  - Use pathlib to check paths: PureWindowsPath class is
    used for every Windows path (paths that contain '\\' or
    ':' or '|'), PurePath otherwise.
  - Add leading slash to Windows paths with drive spec
    before converting to URL.
2018-07-18 14:49:05 +02:00
Davide Brunato e967aa6db8 Use pathlib for checking resource URLs 2018-07-18 11:30:13 +02:00
Davide Brunato 0af5307e6c Fix path normalization for Windows platform 2018-07-14 15:52:03 +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 7980ea4e35 Completed tests for XMLResource class 2018-07-13 16:51:26 +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 c72442ed3c Fix XMLResource._fromsource() internal method
- File object processing miss to find URL
  - Considering StringIO processing
  - Add tests for resource APIs
2018-07-12 19:04:03 +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 b697c6f7b9 Fix a bug for normalize_url()
- The normalization failed when url contains a .. or . subpaths
    and base_url with a valid scheme is provided
  - The fix could be also influence issue #44
2018-07-04 18:41:40 +02:00
Davide Brunato db1821a229 Put a patch for issue #35 in XsdGroup.iter_decode
- Related to residual emptiable content parsing of a top level
    group of a sequence
  - The patch code have to be moved to XsdGroup
  - Added a case for the issue

Some refactoring to XsdComponent: target_namespace, namespace and maps
are trasformed to @property functions.

Update documentation for pass doctests.
2018-01-20 06:11:43 +01:00
Davide Brunato d1139433fc Revise tests and add instance nillability overrides (xsi:nil attribute)
Test cases refactoring:
  - now the base dir is tests/cases/
  - test cases grouped into examples/, features/ and issues/ subdirs
  - added --extra argument to test scripts that use extra cases
2018-01-15 06:40:13 +01:00
Davide Brunato d56208106b Update test scripts
- add setUpClass() method to test classes
  - XMLSchemaTestCase class removed
  - common test definitions are now in xmlschema/tests/__init__.py
  - xmlschema/tests/_test_common.py deleted
2018-01-09 10:52:39 +01:00
Davide Brunato 43d0c77eee Fixed bug #34, updated copyright information. 2018-01-08 09:15:09 +01:00
Davide Brunato 161553b20f Tests improving and bugfix:
- Rewritten imports and use a common factory function for tests
  - Fixed an unclosed urlopen into function get_xml_root of
    xmlschema/resource.py module
2017-11-18 22:17:20 +01:00
Davide Brunato f788c0a00e Improving tests and bugfix of issue #22. 2017-11-17 14:41:44 +01:00
Davide Brunato 4a8b1b7d82 Fixed some bugs:
* resources.fetch_resource function now expect a single location
  * fixed identity constraint uniqueness check
  * fixed complexContent extension
  * fixed XsdComplexType.has_simple_content method
2017-10-12 07:05:53 +02:00