Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Using 'Raises' are now asserted! #54

Merged
merged 1 commit into from
Dec 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pydatastructs/linear_data_structures/tests/test_arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ def test_OneDimensionalArray():
assert ODA(int, [1.0, 2, 3, 4, 5], 5)
assert ODA(int, 5)
assert ODA(int, [1.0, 2, 3])
raises(IndexError, lambda: A[7])
raises(IndexError, lambda: A[-1])
raises(ValueError, lambda: ODA())
raises(ValueError, lambda: ODA(int, 1, 2, 3))
raises(TypeError, lambda: ODA(int, 5.0, set([1, 2, 3])))
raises(TypeError, lambda: ODA(int, 5.0))
raises(TypeError, lambda: ODA(int, set([1, 2, 3])))
raises(ValueError, lambda: ODA(int, 3, [1]))
assert raises(IndexError, lambda: A[7])
assert raises(IndexError, lambda: A[-1])
assert raises(ValueError, lambda: ODA())
assert raises(ValueError, lambda: ODA(int, 1, 2, 3))
assert raises(TypeError, lambda: ODA(int, 5.0, set([1, 2, 3])))
assert raises(TypeError, lambda: ODA(int, 5.0))
assert raises(TypeError, lambda: ODA(int, set([1, 2, 3])))
assert raises(ValueError, lambda: ODA(int, 3, [1]))

def test_DynamicOneDimensionalArray():
DODA = DynamicOneDimensionalArray
Expand Down
14 changes: 7 additions & 7 deletions pydatastructs/miscellaneous_data_structures/tests/test_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ def test_Stack():
s.push(3)
assert s.top == 3
assert str(s) == '[1, 2, 3]'
raises(ValueError, lambda: s.push(4))
assert raises(ValueError, lambda: s.push(4))
assert s.pop() == 3
assert s.pop() == 2
assert s.pop() == 1
assert s.top == 0
raises(ValueError, lambda: s.pop())
raises(ValueError, lambda: Stack())
raises(TypeError, lambda: Stack(maxsize=8, top=3.5))
raises(ValueError, lambda: Stack(maxsize=5, top=0, items=[1, 2, 3]))
raises(ValueError, lambda: Stack(maxsize=5, top=0,
assert raises(ValueError, lambda: s.pop())
assert raises(ValueError, lambda: Stack())
assert raises(TypeError, lambda: Stack(maxsize=8, top=3.5))
assert raises(ValueError, lambda: Stack(maxsize=5, top=0, items=[1, 2, 3]))
assert raises(ValueError, lambda: Stack(maxsize=5, top=0,
items=OneDimensionalArray(int, 6)))
raises(NotImplementedError, lambda: Stack(implementation='',
assert raises(NotImplementedError, lambda: Stack(implementation='',
maxsize=5, top=0))
10 changes: 5 additions & 5 deletions pydatastructs/trees/tests/test_binary_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ def test_BinaryTreeTraversal():
"(None, 'A', 'A', None)", "(5, 'D', 'D', 6)", "(8, 'I', 'I', None)",
"(None, 'C', 'C', None)", "(None, 'E', 'E', None)",
"(None, 'H', 'H', None)"]
raises(NotImplementedError, lambda: trav.breadth_first_search(strategy='iddfs'))
raises(NotImplementedError, lambda: trav.depth_first_search(order='in_out_order'))
raises(TypeError, lambda: BTT(1))
assert raises(NotImplementedError, lambda: trav.breadth_first_search(strategy='iddfs'))
assert raises(NotImplementedError, lambda: trav.depth_first_search(order='in_out_order'))
assert raises(TypeError, lambda: BTT(1))

def test_AVLTree():
a = AVLTree('M', 'M')
Expand Down Expand Up @@ -229,8 +229,8 @@ def test_AVLTree():
a5.tree[12].size = 1
a5.tree[13].size = 1

raises(ValueError, lambda: a5.select(0))
raises(ValueError, lambda: a5.select(15))
assert raises(ValueError, lambda: a5.select(0))
assert raises(ValueError, lambda: a5.select(15))
assert a5.rank(-1) == None
def test_select_rank(expected_output):
output = []
Expand Down
2 changes: 1 addition & 1 deletion pydatastructs/trees/tests/test_space_partitioning_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def test_OneDimensionalSegmentTree():
assert segt.cache == True
assert len(segt.query(-1)) == 0
assert len(segt.query(2.8)) == 2
raises(ValueError, lambda: ODST([(1, 2, 3)]))
assert raises(ValueError, lambda: ODST([(1, 2, 3)]))