MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_dupes_construct

Method test_dupes_construct

test/base/test_utils.py:1036–1064  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1034 eq_(ci.keys(), ["c1", "c2", "c3", "c2"])
1035
1036 def test_dupes_construct(self):
1037 c1, c2a, c3, c2b = (
1038 column("c1"),
1039 column("c2"),
1040 column("c3"),
1041 column("c2"),
1042 )
1043
1044 cc = sql.WriteableColumnCollection(
1045 columns=[("c1", c1), ("c2", c2a), ("c3", c3), ("c2", c2b)]
1046 )
1047
1048 eq_(cc._all_columns, [c1, c2a, c3, c2b])
1049
1050 eq_(list(cc), [c1, c2a, c3, c2b])
1051 eq_(cc.keys(), ["c1", "c2", "c3", "c2"])
1052
1053 assert cc.contains_column(c2a)
1054 assert cc.contains_column(c2b)
1055
1056 # this is deterministic
1057 is_(cc["c2"], c2a)
1058
1059 self._assert_collection_integrity(cc)
1060
1061 ci = cc.as_readonly()
1062 eq_(ci._all_columns, [c1, c2a, c3, c2b])
1063 eq_(list(ci), [c1, c2a, c3, c2b])
1064 eq_(ci.keys(), ["c1", "c2", "c3", "c2"])
1065
1066 def test_identical_dupe_construct(self):
1067 c1, c2, c3 = (column("c1"), column("c2"), column("c3"))

Callers

nothing calls this directly

Calls 7

as_readonlyMethod · 0.95
columnFunction · 0.90
eq_Function · 0.90
is_Function · 0.90
keysMethod · 0.45
contains_columnMethod · 0.45

Tested by

no test coverage detected