MCPcopy Index your code
hub / github.com/python/cpython / test_backslash_continuation

Method test_backslash_continuation

Lib/test/test_tokenize.py:1951–1962  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1949 self.assertRaises(ValueError, u.add_whitespace, (2,1))
1950
1951 def test_backslash_continuation(self):
1952 # The problem is that <whitespace>\<newline> leaves no token
1953 u = tokenize.Untokenizer()
1954 u.prev_row = 1
1955 u.prev_col = 1
1956 u.tokens = []
1957 u.add_whitespace((2, 0))
1958 self.assertEqual(u.tokens, ['\\\n'])
1959 u.prev_row = 2
1960 u.add_whitespace((4, 4))
1961 self.assertEqual(u.tokens, ['\\\n', '\\\n\\\n', ' '])
1962 TestRoundtrip.check_roundtrip(self, 'a\n b\n c\n \\\n c\n')
1963
1964 def test_iter_compat(self):
1965 u = tokenize.Untokenizer()

Callers

nothing calls this directly

Calls 3

add_whitespaceMethod · 0.95
assertEqualMethod · 0.45
check_roundtripMethod · 0.45

Tested by

no test coverage detected