MCPcopy
hub / github.com/dmlc/dgl / test_is_sorted

Function test_is_sorted

tests/python/common/test_heterograph-misc.py:427–450  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

425
426
427def test_is_sorted():
428 u_src, u_dst = edge_pair_input(False)
429 s_src, s_dst = edge_pair_input(True)
430
431 u_src = F.tensor(u_src, dtype=F.int32)
432 u_dst = F.tensor(u_dst, dtype=F.int32)
433 s_src = F.tensor(s_src, dtype=F.int32)
434 s_dst = F.tensor(s_dst, dtype=F.int32)
435
436 src_sorted, dst_sorted = dgl.utils.is_sorted_srcdst(u_src, u_dst)
437 assert src_sorted == False
438 assert dst_sorted == False
439
440 src_sorted, dst_sorted = dgl.utils.is_sorted_srcdst(s_src, s_dst)
441 assert src_sorted == True
442 assert dst_sorted == True
443
444 src_sorted, dst_sorted = dgl.utils.is_sorted_srcdst(u_src, u_dst)
445 assert src_sorted == False
446 assert dst_sorted == False
447
448 src_sorted, dst_sorted = dgl.utils.is_sorted_srcdst(s_src, u_dst)
449 assert src_sorted == True
450 assert dst_sorted == False
451
452
453def test_default_types():

Callers 1

Calls 1

edge_pair_inputFunction · 0.85

Tested by

no test coverage detected