Beispiel #1
0
 def test_formatter_by_named_row2(self):
     """Test a list of string as index"""
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     f = NamedRowFormatter(["Row 1", "Row 2"], str)
     s.apply_formatter(f)
     assert s.row["Row 1"] == ["1", "2", "3"]
     assert s.row["Row 2"] == ["4", "5", "6"]
Beispiel #2
0
 def test_add(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     data = OrderedDict({
         "Row 5": [10, 11, 12]
         }
     )
     s = s.row + data
     assert s.row["Row 5"] == [10, 11, 12]
Beispiel #3
0
 def test_set_named_row(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     s.row["Row 2"] = [11, 11, 11]
     assert s.row["Row 2"] == [11, 11, 11]
Beispiel #4
0
 def test_delete_indexed_row2(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     s.delete_named_row_at(2)
     assert s.number_of_rows() == 3
     s.row["Row 2"]  # already deleted
Beispiel #5
0
 def test_add_wrong_type(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     s = s.row + "string type"  # bang
Beispiel #6
0
 def test_extend_rows_using_wrong_data_type(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     s.extend_rows([1, 2])
Beispiel #7
0
 def test_row_series_to_dict(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     content = s.to_dict(True)
     keys = ["Row 0", "Row 1", "Row 2", "Row 3"]
     assert keys == list(content.keys())
Beispiel #8
0
 def test_formatter_by_named_row_2(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     s.row.format("Row 1", str)
     assert s.row["Row 1"] == ["1", "2", "3"]
Beispiel #9
0
 def test_formatter_by_named_row(self):
     s = NominableSheet(self.data, "test")
     s.name_rows_by_column(0)
     f = NamedRowFormatter("Row 1", str)
     s.apply_formatter(f)
     assert s.row["Row 1"] == ["1", "2", "3"]