def test_9(self):
     index = f(
         searchAnchor=2,
         # Place searchAnchor between ``abc`` and ``d``.
         searchText='abcd',
         targetText='xxabcdabcdabcdxxx')
     self.assertEqual(index, 4)
Beispiel #2
0
 def test_5(self):
     index = f(searchAnchor = 6,
               # Place searchAnchor between ``# test`` and ``\n# test``.
               searchText = '# test\n# test',
               targetText = 'test\ntest')
               # The expected targetText index is between ``test`` and ``\ntest``.
     self.assertEqual(index, 4)
Beispiel #3
0
 def test_6(self):
     index = f(
         searchAnchor=73 - 34,
         searchText="# The :doc:`README` user manual gives a broad overview of this system. In contrast, this document discusses the implementation specifics of the CodeChat system.",
         targetText="The CodeChat user manual gives a broad overview of this system. In contrast, this document discusses the implementation specifics of the CodeChat system.",
     )
     self.assertEqual(index, 66 - 34)
Beispiel #4
0
 def test_12(self):
     index = f(searchAnchor = 6,
               # Place searchAnchor between ``abcdab`` and ``cdabcd``.
               searchText = 'abcdabcdabcd',
               targetText = 'abcd')
               # The expected targetText index is between ``ab`` and ``cd``.
     self.assertEqual(index, 2)
Beispiel #5
0
 def test_3(self):
     index = f(searchAnchor = 5,
               # Place searchAnchor between ``// te`` and ``st``.
               searchText = '// test',
               targetText = 'test')
               # The expected targetText index is between ``te`` and ``st``.
     self.assertEqual(index, 2)
Beispiel #6
0
 def test_11(self):
     index = f(searchAnchor = 14,
               # Place searchAnchor between ```head <http://`` and ``head>`_ tail``.
               searchText = '`head <http://head>`_ tail',
               targetText = 'head tail')
               # The expected targetText index is between ``head t`` and ``ail``.
     self.assertEqual(index, 5)
Beispiel #7
0
 def test_9(self):
     index = f(searchAnchor = 2,
               searchText = 'abcd',
               targetText = 'xxabcdabcdabcdxxx')
     # This is a typical multiple match case. will return a -1
     ##self.assertIn(index, (4,8,12))
     self.assertEqual(index, -1)
Beispiel #8
0
 def test_8(self):
     index = f(searchAnchor = 6,
               # Place searchAnchor between ``bwxyzc`` and ``d``.
               searchText = 'bwxyzcd',
               targetText = 'bqwc?xyzaad')
               # The expected targetText index is between ``bqwc?xyz`` and ``d``.
     self.assertIn(index, (8, 9, 10))
Beispiel #9
0
 def test_15(self):
     index = f(searchAnchor = 4,
               # Place searchAnchor between ``test`` and \`` (an empty string).
               searchText = 'test',
               targetText = '\n\n\n\ntest\n\n\n\n')
               # The expected targetText index is between ``\n\n\n\ntest`` and
               # ``\n\n\n\n``.
     self.assertEqual(index, 8)
Beispiel #10
0
 def test_9(self):
     index = f(
         searchAnchor=2,
         # Place searchAnchor between ``abc`` and ``d``.
         searchText="abcd",
         targetText="xxabcdabcdabcdxxx",
     )
     self.assertEqual(index, 4)
Beispiel #11
0
 def test_8(self):
     index = f(
         searchAnchor=6,
         # Place searchAnchor between ``bwxyzc`` and ``d``.
         searchText='bwxyzcd',
         targetText='bqwc?xyzaad')
     # The expected targetText index is between ``bqwc?xyz`` and ``d``.
     self.assertIn(index, (8, 9, 10))
Beispiel #12
0
 def test_5(self):
     index = f(
         searchAnchor=6,
         # Place searchAnchor between ``# test`` and ``\n# test``.
         searchText='# test\n# test',
         targetText='test\ntest')
     # The expected targetText index is between ``test`` and ``\ntest``.
     self.assertEqual(index, 4)
Beispiel #13
0
 def test_11(self):
     index = f(
         searchAnchor=14,
         # Place searchAnchor between ```head <http://`` and ``head>`_ tail``.
         searchText='`head <http://head>`_ tail',
         targetText='head tail')
     # The expected targetText index is between ``head t`` and ``ail``.
     self.assertEqual(index, 5)
Beispiel #14
0
 def test_12(self):
     index = f(
         searchAnchor=6,
         # Place searchAnchor between ``abcdab`` and ``cdabcd``.
         searchText='abcdabcdabcd',
         targetText='abcd')
     # The expected targetText index is between ``ab`` and ``cd``.
     self.assertEqual(index, 2)
Beispiel #15
0
 def test_3(self):
     index = f(
         searchAnchor=5,
         # Place searchAnchor between ``// te`` and ``st``.
         searchText='// test',
         targetText='test')
     # The expected targetText index is between ``te`` and ``st``.
     self.assertEqual(index, 2)
Beispiel #16
0
 def test_15(self):
     index = f(
         searchAnchor=4,
         # Place searchAnchor between ``test`` and \`` (an empty string).
         searchText='test',
         targetText='\n\n\n\ntest\n\n\n\n')
     # The expected targetText index is between ``\n\n\n\ntest`` and
     # ``\n\n\n\n``.
     self.assertEqual(index, 8)
Beispiel #17
0
 def test_1(self):
     index = f(
         searchAnchor=2,
         # Place searchAnchor between ``te`` and ``st``.
         searchText="test",
         targetText="test",
     )
     # The expected index is between ``te`` and ``st``.
     self.assertEqual(index, 2)
Beispiel #18
0
 def test_7(self):
     index = f(
         searchAnchor=9,
         # Place searchAnchor between ``bqwc?xyza`` and ``ad``.
         searchText="bqwc?xyzaad",
         targetText="bwxyzcd",
     )
     # The expected targetText index is between ``bwxyz`` and ``d``.
     self.assertIn(index, (5, 6))
Beispiel #19
0
 def test_6(self):
     index = f(
         searchAnchor=73 - 34,
         searchText=
         '# The :doc:`README` user manual gives a broad overview of this system. In contrast, this document discusses the implementation specifics of the CodeChat system.',
         targetText=
         'The CodeChat user manual gives a broad overview of this system. In contrast, this document discusses the implementation specifics of the CodeChat system.'
     )
     self.assertEqual(index, 66 - 34)
Beispiel #20
0
 def test_4(self):
     index = f(
         searchAnchor=4,
         # Place searchAnchor between ``test`` and ``\ntest``.
         searchText="test\ntest",
         targetText="test\ntest",
     )
     # The expected targetText index is between ``test`` and ``\ntest``.
     self.assertEqual(index, 4)
Beispiel #21
0
 def test_14(self):
     index = f(
         searchAnchor=8,
         # Place searchAnchor between ``\n\n\n\ntest`` and ``\n\n\n\n``.
         searchText="\n\n\n\ntest\n\n\n\n",
         targetText="test",
     )
     # The expected targetText index is between ``test`` and \``
     # (an empty string).
     self.assertEqual(index, 4)
Beispiel #22
0
 def test_13(self):
     index = f(searchAnchor = 8,
               # Place searchAnchor between ``\n\n\n\ntest`` and ``\n\n\n\n``.
               searchText = '\n\n\n\ntest\n\n\n\n',
               targetText = ' test    ')
               # The expected targetText index is between ' test' and '    '.
               #
               # .. Note: ReST doesn't like whitespace after a literal block
               #    start string. Instead of working around it, I've just
               #    escaped it with a backslash.
     self.assertEqual(index, 5)
Beispiel #23
0
 def test_13(self):
     index = f(
         searchAnchor=8,
         # Place searchAnchor between ``\n\n\n\ntest`` and ``\n\n\n\n``.
         searchText='\n\n\n\ntest\n\n\n\n',
         targetText=' test    ')
     # The expected targetText index is between ' test' and '    '.
     #
     # .. Note: ReST doesn't like whitespace after a literal block
     #    start string. Instead of working around it, I've just
     #    escaped it with a backslash.
     self.assertEqual(index, 5)
Beispiel #24
0
 def test_10(self):
     index = f(searchAnchor = 4,
               searchText = 'xxabcdabcdabcdxxx',
               targetText = 'abcd')
Beispiel #25
0
 def test_8(self):
     index = f(searchAnchor = 6,
               searchText = 'bwxyzcd',
               targetText = 'bqwc?xyzaad')
     self.assertIn(index, (9,10))
Beispiel #26
0
 def test_7(self):
     index = f(searchAnchor = 9,
               searchText = 'bqwc?xyzaad',
               targetText = 'bwxyzcd')
     self.assertEqual(index, 6)
Beispiel #27
0
 def test_5(self):
     index = f(searchAnchor = 6,
               searchText = '# test\n# test',
               targetText = 'test\ntest')
     self.assertEqual(index, 4)
Beispiel #28
0
 def test_3(self):
     index = f(searchAnchor = 5,
               searchText = '// test',
               targetText = 'test')
     self.assertEqual(index, 2)
Beispiel #29
0
 def test_2(self):
     index = f(searchAnchor = 4,
               searchText = '# test',
               targetText = 'test')
     self.assertEqual(index, 2)
Beispiel #30
0
 def test_11(self):
     index = f(searchAnchor = 57,
               searchText = 'age = None# `exclude_patterns# <http://sphinx-doc.org/config.html#confval-exclude_patterns>`_: List of# patterns, re',
               targetText = 'for a list of supported languages.##language = None exclude_patterns: List of patterns, re')
Beispiel #31
0
 def test_9(self):
     index = f(searchAnchor = 2,
               # Place searchAnchor between ``abc`` and ``d``.
               searchText = 'abcd',
               targetText = 'xxabcdabcdabcdxxx')
     self.assertEqual(index, -1)