MCPcopy
hub / github.com/burnash/gspread / test_findall

Method test_findall

tests/worksheet_test.py:818–851  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

816
817 @pytest.mark.vcr()
818 def test_findall(self):
819 list_len = 10
820 range_label = "A1:A%s" % list_len
821 cell_list = self.sheet.range(range_label)
822
823 sg = self._sequence_generator()
824
825 value = next(sg)
826
827 for c in cell_list:
828 c.value = value
829 self.sheet.update_cells(cell_list)
830
831 result_list = self.sheet.findall(value)
832
833 self.assertEqual(list_len, len(result_list))
834
835 for c in result_list:
836 self.assertEqual(c.value, value)
837
838 cell_list = self.sheet.range(range_label)
839
840 value = next(sg)
841 for c in cell_list:
842 char = chr(random.randrange(ord("a"), ord("z")))
843 c.value = "{}{}_{}{}".format(c.value, char, char.upper(), value)
844
845 self.sheet.update_cells(cell_list)
846
847 o_O_re = re.compile("[a-z]_[A-Z]%s" % value)
848
849 result_list = self.sheet.findall(o_O_re)
850
851 self.assertEqual(list_len, len(result_list))
852
853 @pytest.mark.vcr()
854 def test_get_all_values(self):

Callers

nothing calls this directly

Calls 5

_sequence_generatorMethod · 0.80
update_cellsMethod · 0.80
findallMethod · 0.80
formatMethod · 0.80
rangeMethod · 0.45

Tested by

no test coverage detected