Beispiel #1
0
    def __eq__(self, other):
        """Determines if two Notebooks are equivalent to each other (more or
        less).

        Whitespace is ignored in certain contexts (see normal.py for the
        details). The order of top-level elements (head, ipython-log, sheet) are
        currently *not* ignored although it probably should be.
        """
        return normal.c14n(self.root) == normal.c14n(other.root)
def test_anti_mixed():
    roots = [ET.fromstring(x) for x in anti_mixed_batch]
    str0 = normal.c14n(ET.fromstring(mixed_batch[0]))
    for i in range(len(roots)):
        assert str0 != normal.c14n(roots[i])
def test_mixed():
    roots = [ET.fromstring(x) for x in mixed_batch]
    str0 = normal.c14n(roots[0])
    for i in range(1, len(roots)):
        assert str0 == normal.c14n(roots[i])
def test_anti_stripnewline():
    roots = [ET.fromstring(x) for x in anti_stripnewline_batch]
    str0 = normal.c14n(ET.fromstring(stripnewline_batch[0]))
    for i in range(len(roots)):
        assert str0 != normal.c14n(roots[i])
def test_stripnewline():
    roots = [ET.fromstring(x) for x in stripnewline_batch]
    str0 = normal.c14n(roots[0])
    for i in range(1, len(roots)):
        assert str0 == normal.c14n(roots[i])