def test_path_t_roundtrip(): # check that T repr roundrips assert repr(T['a'].b.c()) == "T['a'].b.c()" assert repr(T[1:]) == "T[1:]" assert repr(T[::3, 1:, 1:2, :2:3]) == "T[::3, 1:, 1:2, :2:3]" # check that Path repr roundtrips assert repr(Path('a', 1, 'b.b', -1.0)) == "Path('a', 1, 'b.b', -1.0)" # check that Path repr roundtrips when it contains Ts assert repr(Path(T['a'].b, 'c', T['d'].e)) == "Path(T['a'].b, 'c', T['d'].e)" # check that T instances containing Path access revert to repring with Path assert repr(Path(T['a'].b, 'c', T['d'].e).path_t) == "Path(T['a'].b, 'c', T['d'].e)" # check that Paths containing only T objects reduce to a T (joining the T objects) assert repr(Path(T['a'].b, T.c())) == "T['a'].b.c()" # check that multiple nested paths reduce assert repr(Path(Path(Path('a')))) == "Path('a')" # check builtin repr assert repr(T[len]) == 'T[len]' assert repr(T.func(len, sum)) == 'T.func(len, sum)'
def test_path_t_roundtrip(): # check that T repr roundrips assert repr(T['a'].b.c()) == "T['a'].b.c()" # check that Path repr roundtrips assert repr(Path('a', 1, 'b.b', -1.0)) == "Path('a', 1, 'b.b', -1.0)" # check that Path repr roundtrips when it contains Ts assert repr(Path(T['a'].b, 'c', T['d'].e)) == "Path(T['a'].b, 'c', T['d'].e)" # check that T instances containing Path access revert to repring with Path assert repr(Path(T['a'].b, 'c', T['d'].e).path_t) == "Path(T['a'].b, 'c', T['d'].e)" # check that Paths containing only T objects reduce to a T (joining the T objects) assert repr(Path(T['a'].b, T.c())) == "T['a'].b.c()" # check that multiple nested paths reduce assert repr(Path(Path(Path('a')))) == "Path('a')"