Added a script for testing XPathContext class

This commit is contained in:
Davide Brunato 2019-05-21 07:17:58 +02:00
parent 1d23f5b13f
commit c97acb9eb8
7 changed files with 39 additions and 6 deletions

View File

@ -2,6 +2,10 @@
CHANGELOG
*********
`v1.1.9`_ (TBD)
===============
* Added tests for uncovered code
`v1.1.8`_ (2019-05-20)
======================
* Added code coverage and flake8 checks
@ -131,3 +135,4 @@ CHANGELOG
.. _v1.1.6: https://github.com/brunato/elementpath/compare/v1.1.5...v1.1.6
.. _v1.1.7: https://github.com/brunato/elementpath/compare/v1.1.6...v1.1.7
.. _v1.1.8: https://github.com/brunato/elementpath/compare/v1.1.7...v1.1.8
.. _v1.1.9: https://github.com/brunato/elementpath/compare/v1.1.8...v1.1.9

View File

@ -29,9 +29,9 @@ copyright = '2018-2019, SISSA (International School for Advanced Studies)'
author = 'Davide Brunato'
# The short X.Y version
version = ''
version = '1.1'
# The full version, including alpha/beta/rc tags
release = '1.1.8'
release = '1.1.9'
# -- General configuration ---------------------------------------------------

View File

@ -8,7 +8,7 @@
#
# @author Davide Brunato <brunato@sissa.it>
#
__version__ = '1.1.8'
__version__ = '1.1.9'
__author__ = "Davide Brunato"
__contact__ = "brunato@sissa.it"
__copyright__ = "Copyright 2018-2019, SISSA"

View File

@ -15,7 +15,7 @@ with open("README.rst") as readme:
setup(
name='elementpath',
version='1.1.8',
version='1.1.9',
packages=['elementpath'],
author='Davide Brunato',
author_email='brunato@sissa.it',

26
tests/test_contexts.py Normal file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c), 2018-2019, SISSA (International School for Advanced Studies).
# All rights reserved.
# This file is distributed under the terms of the MIT License.
# See the file 'LICENSE' in the root directory of the present
# distribution, or http://opensource.org/licenses/MIT.
#
# @author Davide Brunato <brunato@sissa.it>
#
import unittest
import xml.etree.ElementTree as ElementTree
from elementpath import *
class XPathContextTest(unittest.TestCase):
root = ElementTree.XML('<author>Dickens</author>')
def test_context_initialization(self):
self.assertRaises(TypeError, XPathContext, None)
if __name__ == '__main__':
unittest.main()

View File

@ -26,15 +26,17 @@ if __name__ == '__main__':
try:
from tests.test_helpers import ExceptionHelpersTest, NamespaceHelpersTest, XPathHelpersTest
from tests.test_datatypes import UntypedAtomicTest, DateTimeTypesTest, DurationTypesTest, TimezoneTypeTest
from tests.test_contexts import XPathContextTest
from tests.test_xpath1_parser import XPath1ParserTest, LxmlXPath1ParserTest
from tests.test_xpath2_parser import XPath2ParserTest, LxmlXPath2ParserTest
from tests.test_schema_proxy import XPath2ParserXMLSchemaTest, LxmlXPath2ParserXMLSchemaTest
from tests.test_selectors import SelectorTest
from tests.test_selectors import XPathSelectorsTest
from tests.test_package import PackageTest
except ImportError:
# Python 2 fallback
from test_helpers import ExceptionHelpersTest, NamespaceHelpersTest, XPathHelpersTest
from test_datatypes import UntypedAtomicTest, DateTimeTypesTest, DurationTypesTest, TimezoneTypeTest
from test_contexts import XPathContextTest
from test_xpath1_parser import XPath1ParserTest, LxmlXPath1ParserTest
from test_xpath2_parser import XPath2ParserTest, LxmlXPath2ParserTest
from test_schema_proxy import XPath2ParserXMLSchemaTest, LxmlXPath2ParserXMLSchemaTest

View File

@ -15,7 +15,7 @@ import xml.etree.ElementTree as ElementTree
from elementpath import *
class SelectorTest(unittest.TestCase):
class XPathSelectorsTest(unittest.TestCase):
root = ElementTree.XML('<author>Dickens</author>')
def test_select_function(self):