Skip to content

Commit

Permalink
Write more unit tests on node.
Browse files Browse the repository at this point in the history
  • Loading branch information
don4get committed Jan 14, 2020
1 parent 9a773cc commit 27dbdcf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ repos:
hooks:
- id: black
language_version: python3.6
stages: [commit]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
hooks:
Expand Down
17 changes: 8 additions & 9 deletions tests/node_test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import pytest
from PyQt5.QtCore import QPointF
from PyQt5.QtWidgets import QGraphicsView, QMainWindow
from PyQt5.QtWidgets import QMainWindow

from nodedge.edge import Edge
from nodedge.editor_widget import EditorWidget
from nodedge.node import Node

Expand Down Expand Up @@ -46,10 +45,10 @@ def test_posProperty(undefinedNode: Node):
undefinedNode.pos = (expectedPos.x(), expectedPos.y())
assert undefinedNode.pos == expectedPos

# wrongPos = [1, 2, 3]
# with pytest.raises(ValueError):
# undefinedNode.pos = wrongPos
#
# stringPos = ["a", "b"]
# with pytest.raises(TypeError):
# undefinedNode.pos = stringPos
wrongPos = [1, 2, 3]
with pytest.raises(ValueError):
undefinedNode.pos = wrongPos

stringPos = ["a", "b"]
with pytest.raises(TypeError):
undefinedNode.pos = stringPos

0 comments on commit 27dbdcf

Please sign in to comment.