Skip to content

Commit 84b1415

Browse files
cclausskeon
authored andcommitted
Travis CI: Add more flake8 tests (keon#512)
* Travis CI: Add more flake8 tests * Use ==/!= to compare str, bytes, and int literals Identity is not the same thing as equality in Python. * Use ==/!= to compare str, bytes, and int literals
1 parent 44298eb commit 84b1415

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ install:
1616
- pip install -r test_requirements.txt
1717
before_script:
1818
# stop the build if there are Python syntax errors or undefined names
19-
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
19+
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
2020
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
2121
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
2222
script:

algorithms/arrays/move_zeros.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def move_zeros(array):
1313
zeros = 0
1414

1515
for i in array:
16-
if i is 0: # not using `not i` to avoid `False`, `[]`, etc.
16+
if i == 0: # not using `not i` to avoid `False`, `[]`, etc.
1717
zeros += 1
1818
else:
1919
result.append(i)

algorithms/tree/red_black_tree/red_black_tree.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ def fix_insert(self, node):
9393
return
9494
# case 2 the parent color is black, do nothing
9595
# case 3 the parent color is red
96-
while node.parent and node.parent.color is 1:
96+
while node.parent and node.parent.color == 1:
9797
if node.parent is node.parent.parent.left:
9898
uncle_node = node.parent.parent.right
99-
if uncle_node and uncle_node.color is 1:
99+
if uncle_node and uncle_node.color == 1:
100100
# case 3.1 the uncle node is red
101101
# then set parent and uncle color is black and grandparent is red
102102
# then node => node.parent
@@ -118,7 +118,7 @@ def fix_insert(self, node):
118118
self.right_rotate(node.parent.parent)
119119
else:
120120
uncle_node = node.parent.parent.left
121-
if uncle_node and uncle_node.color is 1:
121+
if uncle_node and uncle_node.color == 1:
122122
# case 3.1 the uncle node is red
123123
# then set parent and uncle color is black and grandparent is red
124124
# then node => node.parent

0 commit comments

Comments
 (0)