MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_row_special_names

Method test_row_special_names

test/sql/test_resultset.py:1860–1893  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1858 is_true(isinstance(row, collections_abc.Sequence))
1859
1860 def test_row_special_names(self):
1861 metadata = SimpleResultMetaData(["key", "count", "index", "foo"])
1862 row = Row(
1863 metadata,
1864 [None, None, None, None],
1865 metadata._key_to_index,
1866 ["kv", "cv", "iv", "f"],
1867 )
1868 is_true(isinstance(row, collections_abc.Sequence))
1869
1870 eq_(row.key, "kv")
1871 eq_(row.count, "cv")
1872 eq_(row.index, "iv")
1873
1874 eq_(row._mapping["foo"], "f")
1875 eq_(row._mapping["count"], "cv")
1876 eq_(row._mapping["index"], "iv")
1877
1878 metadata = SimpleResultMetaData(["key", "q", "p"])
1879
1880 row = Row(
1881 metadata,
1882 [None, None, None],
1883 metadata._key_to_index,
1884 ["kv", "cv", "iv"],
1885 )
1886 is_true(isinstance(row, collections_abc.Sequence))
1887
1888 eq_(row.key, "kv")
1889 eq_(row.q, "cv")
1890 eq_(row.p, "iv")
1891 eq_(row.index("cv"), 1)
1892 eq_(row.count("cv"), 1)
1893 eq_(row.count("x"), 0)
1894
1895 def test_new_row_no_dict_behaviors(self):
1896 """This mode is not used currently but will be once we are in 2.0."""

Callers

nothing calls this directly

Calls 6

RowClass · 0.90
is_trueFunction · 0.90
eq_Function · 0.90
indexMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected