MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_row_special_names

Method test_row_special_names

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

Source from the content-addressed store, hash-verified

1923 is_true(isinstance(row, collections_abc.Sequence))
1924
1925 def test_row_special_names(self):
1926 metadata = SimpleResultMetaData(["key", "count", "index", "foo"])
1927 row = Row(
1928 metadata,
1929 [None, None, None, None],
1930 metadata._key_to_index,
1931 ["kv", "cv", "iv", "f"],
1932 )
1933 is_true(isinstance(row, collections_abc.Sequence))
1934
1935 eq_(row.key, "kv")
1936 eq_(row.count, "cv")
1937 eq_(row.index, "iv")
1938 eq_(row.foo, "f")
1939
1940 eq_(row._mapping["foo"], "f")
1941 eq_(row._mapping["count"], "cv")
1942 eq_(row._mapping["index"], "iv")
1943
1944 metadata = SimpleResultMetaData(["key", "q", "p"])
1945
1946 row = Row(
1947 metadata,
1948 [None, None, None],
1949 metadata._key_to_index,
1950 ["kv", "cv", "iv"],
1951 )
1952 is_true(isinstance(row, collections_abc.Sequence))
1953
1954 eq_(row.key, "kv")
1955 eq_(row.q, "cv")
1956 eq_(row.p, "iv")
1957 eq_(row.index("cv"), 1)
1958 eq_(row.count("cv"), 1)
1959 eq_(row.count("x"), 0)
1960
1961 def test_row_precedence_normal_names(self):
1962 f = ("_fields", "_asdict", "_mapping", "as_tuple")

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