FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python/algorithms/data-structures/stacks/test_node.py at master · AllAlgorithms/python · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on Sep 7, 2025. It is now read-only.
AllAlgorithms
/
python
Public archive
Notifications
You must be signed in to change notification settings
Fork
170
Star
385
Code
Issues
1
Pull requests
19
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
python
/
algorithms
/
data-structures
/
stacks
/
test_node.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (21 loc) · 723 Bytes
Breadcrumbs
python
/
algorithms
/
data-structures
/
stacks
/
test_node.py
Copy path
File metadata and controls
29 lines (21 loc) · 723 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import
unittest
from
node
import
Node
class
TestNode
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
next_node
=
Node
(
'item 2'
)
self
.
node
=
Node
(
'item 1'
,
self
.
next_node
)
def
test_str
(
self
):
self
.
assertEqual
(
str
(
self
.
node
),
'[item 1] -> [item 2]'
)
def
test_get_item
(
self
):
self
.
assertEqual
(
self
.
node
.
get_item
(),
'item 1'
)
def
test_get_next
(
self
):
self
.
assertIs
(
self
.
node
.
get_next
(),
self
.
next_node
)
def
test_set_item
(
self
):
self
.
node
.
set_item
(
'another item'
)
self
.
assertEqual
(
self
.
node
.
get_item
(),
'another item'
)
def
test_set_next
(
self
):
another_node
=
Node
(
'another item'
)
self
.
node
.
set_next
(
another_node
)
self
.
assertIs
(
self
.
node
.
get_next
(),
another_node
)
if
__name__
==
'__main__'
:
unittest
.
main
()
Back
|
FazBrowse Home
|
New Git URL