コード例 #1
0
    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
コード例 #2
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 expected_values == partial_row.values
        assert 711 == partial_row.rowId
        assert 'etag' not in partial_row
コード例 #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)
コード例 #4
0
 def test_constructor__row_id_string_not_castable_to_int(self):
     PartialRow({}, "fourty-two")
コード例 #5
0
 def test_constructor__value_not_dict(self):
     PartialRow([], 123)
コード例 #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)
コード例 #7
0
 def test_constructor__not_all_rows_of_type_PartialRow(self):
     rows = [PartialRow({}, 123), "some string instead"]
     PartialRowset("syn123", rows)
コード例 #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)
コード例 #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)
コード例 #10
0
 def test_constructor__not_all_rows_of_type_PartialRow(self):
     rows = [PartialRow({}, 123), "some string instead"]
     with pytest.raises(ValueError):
         PartialRowset("syn123", rows)
コード例 #11
0
 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
コード例 #12
0
    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
コード例 #13
0
 def test_constructor__row_id_string_not_castable_to_int(self):
     with pytest.raises(ValueError):
         PartialRow({}, "fourty-two")
コード例 #14
0
 def test_constructor__value_not_dict(self):
     with pytest.raises(ValueError):
         PartialRow([], 123)