שלום
אני עובד עם pycharm (למוד פייתון)
אני מנסה להבין איך אני מדפיס פלט כאשר אני מריץ unittests.
למשל אם אני כותב את הטסט הבא:
קוד: |
def test__add__sub_graph(self):
g1=self.graph
new_node_a = Node('a')
new_node_c = Node('c')
new_node_d = Node('d')
new_node_a.add_neighbor(new_node_c, 10)
new_node_c.add_neighbor(new_node_d, 8)
new_node_d.add_neighbor(new_node_c, 9)
g3=Graph("acd",[new_node_a, new_node_c,new_node_d])
# g1=> ('a','b',3),('a','c',7),('b','c',1),('b','a',2)
# g3=> ('c','d',8),('d','c',9),('a','b',3),('a','c',7),('b','c',1),('b','a',2)
# 7 not 10 ^
[b]
print g1.dump()
print g3.dump()
[/b]
g_plus = g1 + g3
edges_plus = g_plus.get_edges()
for e in [('c','d',8),('d','c',9),('a','b',3),('a','c',7),('b','c',1),('b','a',2)]:
self.assertTrue(e in edges_plus, " g1+g2 edge:"+str(e))
e_weight=g_plus.get_edge_weight(e[0],e[1])
self.assertTrue(e_weight==e[2], " g1+g2 get_edge_weight:" + str(e))
self.assertFalse(('a','c',10) in edges_plus, " g1+g2 did not copy edge:" + str(('a','c',10)))
|
אני מקבל בפלט:
קוד: |
D:\Anaconda2\python.exe "C:\Users\somone\AppData\Roaming\JetBrains\PyCharm Community Edition 2016.2.2\helpers\pycharm\noserunner.py" D:\learn_python\DataScience\GraphProject\Tasks\Graph_UnitTest.py::TestDatabase::test__add__sub_graph
Testing started at 08:57 ...
..
----------------------------------------------------------------------
Ran 1 test in 0.001s
OK
Process finished with exit code 0
|
|