def test_scalar_mode_tuples_iterate(self, normal_fixture): metadata = result.SimpleResultMetaData(["a", "b", "c"]) r = result.ChunkedIteratorResult( metadata, normal_fixture, source_supports_scalars=True ) eq_(list(r), [(1,), (2,), (1,), (1,), (4,)])
def test_scalar_mode_scalar_one(self, no_tuple_one_fixture): metadata = result.SimpleResultMetaData(["a", "b", "c"]) r = result.ChunkedIteratorResult( metadata, no_tuple_one_fixture, source_supports_scalars=True ) eq_(r.scalar_one(), 1)
def test_scalar_mode_tuples_all(self, normal_fixture): metadata = result.SimpleResultMetaData(["a", "b", "c"]) r = result.ChunkedIteratorResult(metadata, normal_fixture, source_supports_scalars=True) eq_(r.all(), [(1, 1, 1), (2, 1, 2), (1, 1, 1), (1, 3, 2), (4, 1, 2)])
def test_scalar_mode_unique_scalars_fetchmany(self, normal_fixture): metadata = result.SimpleResultMetaData(["a", "b", "c"]) r = result.ChunkedIteratorResult( metadata, normal_fixture, source_supports_scalars=True ) r = r.scalars().unique() eq_(list(r.partitions(2)), [[1, 2], [4]])
def test_scalar_mode_scalars_iterate(self, no_tuple_fixture): metadata = result.SimpleResultMetaData(["a", "b", "c"]) r = result.ChunkedIteratorResult( metadata, no_tuple_fixture, source_supports_scalars=True ) r = r.scalars() eq_(list(r), [1, 2, 1, 1, 4])
def test_scalar_mode_unique_scalars_all(self, no_tuple_fixture): metadata = result.SimpleResultMetaData(["a", "b", "c"]) r = result.ChunkedIteratorResult( metadata, no_tuple_fixture, source_supports_scalars=True ) r = r.unique().scalars() eq_(r.all(), [1, 2, 4])
def test_scalar_mode_columns0_mapping(self, no_tuple_fixture): metadata = result.SimpleResultMetaData(["a", "b", "c"]) r = result.ChunkedIteratorResult( metadata, no_tuple_fixture, source_supports_scalars=True ) r = r.columns(0).mappings() eq_( list(r), [{"a": 1}, {"a": 2}, {"a": 1}, {"a": 1}, {"a": 4}], )
def test_scalar_mode_mfiltered_unique_mappings_all(self, no_tuple_fixture): metadata = result.SimpleResultMetaData( ["a", "b", "c"], _unique_filters=[int] ) r = result.ChunkedIteratorResult( metadata, no_tuple_fixture, source_supports_scalars=True, ) r = r.unique() eq_(r.mappings().all(), [{"a": 1}, {"a": 2}, {"a": 4}])
def test_scalar_mode_mfiltered_unique_rows_all(self, no_tuple_fixture): metadata = result.SimpleResultMetaData( ["a", "b", "c"], _unique_filters=[int] ) r = result.ChunkedIteratorResult( metadata, no_tuple_fixture, source_supports_scalars=True, ) r = r.unique() eq_(r.all(), [(1,), (2,), (4,)])
def test_scalar_mode_but_accessed_nonscalar_result(self, no_tuple_fixture): metadata = result.SimpleResultMetaData(["a", "b", "c"]) r = result.ChunkedIteratorResult( metadata, no_tuple_fixture, source_supports_scalars=True ) s1 = r.scalars() eq_(r.fetchone(), (1,)) eq_(s1.all(), [2, 1, 1, 4])
def test_unique_scalar_accessors(self, no_tuple_one_fixture, get): metadata = result.SimpleResultMetaData(["a", "b", "c"], _unique_filters=[int]) r = result.ChunkedIteratorResult( metadata, no_tuple_one_fixture, source_supports_scalars=True, ) r = r.unique() eq_(get(r), 1)
def test_scalar_mode_columns0_plain(self, no_tuple_fixture): """test #7953""" metadata = result.SimpleResultMetaData(["a", "b", "c"]) r = result.ChunkedIteratorResult(metadata, no_tuple_fixture, source_supports_scalars=True) r = r.columns(0) eq_( list(r), [(1, ), (2, ), (1, ), (1, ), (4, )], )