diff --git a/.travis.yml b/.travis.yml index 9bc250f..79cf592 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,20 @@ -language: python sudo: false -python: - - 2.7 - - 3.4 - - 3.5 - - 3.6 +language: python +matrix: + include: + - python: 2.7 + - python: 3.4 + - python: 3.5 + - python: 3.6 + - python: 3.7 + dist: xenial + sudo: true install: - - pip install flake8 mock pytest pytest-cov python-coveralls sphinx sphinx_rtd_theme + - pip install flake8 mock + - pip install pytest==3.5.1 + - pip install pytest-cov==2.5.1 + - pip install python-coveralls==2.9.1 + - pip install sphinx sphinx_rtd_theme - pip install . script: - python -m flake8 diff --git a/binarytree/__init__.py b/binarytree/__init__.py index f501c02..7c4a25b 100644 --- a/binarytree/__init__.py +++ b/binarytree/__init__.py @@ -58,9 +58,9 @@ def _is_bst(root, min_value=float('-inf'), max_value=float('inf')): def _is_symmetric(root): - """Check if the binary tree is symmetric + """Check if the binary tree is symmetric. - :param root: Root node of the binary tree + :param root: Root node of the binary tree. :type root: binarytree.Node | None :return: True if the binary tree is symmetric, False otherwise. :rtype: bool @@ -323,7 +323,7 @@ class Node(object): current node and its descendants. :param value: Node value (must be a number). - :type value: int | float + :type value: int | float | numbers.Number :param left: Left child node (default: None). :type left: binarytree.Node | None :param right: Right child node (default: None). @@ -1128,7 +1128,9 @@ def is_bst(self): def is_symmetric(self): """Check if the binary tree is symmetric. - * Left subtree is a mirror of the right subtree around the center + A binary tree is symmetric if it meets the following criteria: + + * Left subtree is a mirror of the right subtree about the root node. :return: True if the binary tree is a symmetric, False otherwise. :rtype: bool @@ -1138,6 +1140,7 @@ def is_symmetric(self): .. doctest:: >>> from binarytree import Node + >>> >>> root = Node(1) >>> root.left = Node(2) >>> root.right = Node(2) @@ -1145,6 +1148,7 @@ def is_symmetric(self): >>> root.left.right = Node(4) >>> root.right.left = Node(4) >>> root.right.right = Node(3) + >>> >>> print(root) __1__ diff --git a/binarytree/version.py b/binarytree/version.py index 8f48aa6..69acc14 100644 --- a/binarytree/version.py +++ b/binarytree/version.py @@ -1 +1 @@ -__version__ = '4.0.0' # pragma: no cover +__version__ = '4.1.0' # pragma: no cover