def test_constructor__name_to_col_id(self):
        values = OrderedDict([("row1", "rowValue"),
                              ("row2", "otherValue")])
        names_to_col_id = {"row1": "12345", "row2": "09876"}
        partial_row = PartialRow(values, 711, nameToColumnId=names_to_col_id)

        expected_values = [{"key": "12345", "value": "rowValue"}, {"key": "09876", "value": "otherValue"}]

        assert expected_values == partial_row.values
        assert 711 == partial_row.rowId
    def test_constructor__values_translation(self):
        values = OrderedDict([("12345", "rowValue"),
                              ("09876", "otherValue")])
        partial_row = PartialRow(values, 711)

        expected_values = [{"key": "12345", "value": "rowValue"}, {"key": "09876", "value": "otherValue"}]

        assert expected_values == partial_row.values
        assert 711 == partial_row.rowId
        assert 'etag' not in partial_row
Beispiel #3
0
    def test_constructor__values_translation(self):
        values = OrderedDict([("12345", "rowValue"), ("09876", "otherValue")])
        partial_row = PartialRow(values, 711)

        expected_values = [{
            "key": "12345",
            "value": "rowValue"
        }, {
            "key": "09876",
            "value": "otherValue"
        }]

        assert_equals(expected_values, partial_row.values)
        assert_equals(711, partial_row.rowId)
        assert_not_in('etag', partial_row)
Beispiel #4
0
 def test_constructor__row_id_string_not_castable_to_int(self):
     PartialRow({}, "fourty-two")
Beispiel #5
0
 def test_constructor__value_not_dict(self):
     PartialRow([], 123)
Beispiel #6
0
 def test_constructor__single_PartialRow(self):
     partial_row = PartialRow({}, 123)
     partial_rowset = PartialRowset("syn123", partial_row)
     assert_equals([partial_row], partial_rowset.rows)
Beispiel #7
0
 def test_constructor__not_all_rows_of_type_PartialRow(self):
     rows = [PartialRow({}, 123), "some string instead"]
     PartialRowset("syn123", rows)
Beispiel #8
0
 def test_constructor__with_etag(self):
     partial_row = PartialRow({}, 420, "my etag")
     assert_equals([], partial_row.values)
     assert_equals(420, partial_row.rowId)
     assert_equals("my etag", partial_row.etag)
Beispiel #9
0
    def test_constructor__row_id_is_int_castable_string(self):
        partial_row = PartialRow({}, "350")

        assert_equals([], partial_row.values)
        assert_equals(350, partial_row.rowId)
        assert_not_in('etag', partial_row)
 def test_constructor__not_all_rows_of_type_PartialRow(self):
     rows = [PartialRow({}, 123), "some string instead"]
     with pytest.raises(ValueError):
         PartialRowset("syn123", rows)
 def test_constructor__with_etag(self):
     partial_row = PartialRow({}, 420, "my etag")
     assert [] == partial_row.values
     assert 420 == partial_row.rowId
     assert "my etag" == partial_row.etag
    def test_constructor__row_id_is_int_castable_string(self):
        partial_row = PartialRow({}, "350")

        assert [] == partial_row.values
        assert 350 == partial_row.rowId
        assert 'etag' not in partial_row
 def test_constructor__row_id_string_not_castable_to_int(self):
     with pytest.raises(ValueError):
         PartialRow({}, "fourty-two")
 def test_constructor__value_not_dict(self):
     with pytest.raises(ValueError):
         PartialRow([], 123)