(self)
| 1920 | ) |
| 1921 | |
| 1922 | def test_array(self): |
| 1923 | c = Column("x", postgresql.ARRAY(Integer)) |
| 1924 | |
| 1925 | self.assert_compile( |
| 1926 | cast(c, postgresql.ARRAY(Integer)), "CAST(x AS INTEGER[])" |
| 1927 | ) |
| 1928 | self.assert_compile( |
| 1929 | c[5], "x[%(x_1)s::INTEGER]", checkparams={"x_1": 5} |
| 1930 | ) |
| 1931 | |
| 1932 | self.assert_compile( |
| 1933 | c[5:7], |
| 1934 | "x[%(x_1)s::INTEGER:%(x_2)s::INTEGER]", |
| 1935 | checkparams={"x_2": 7, "x_1": 5}, |
| 1936 | ) |
| 1937 | self.assert_compile( |
| 1938 | c[5:7][2:3], |
| 1939 | "x[%(x_1)s::INTEGER:%(x_2)s::INTEGER]" |
| 1940 | "[%(param_1)s::INTEGER:%(param_2)s::INTEGER]", |
| 1941 | checkparams={"x_2": 7, "x_1": 5, "param_1": 2, "param_2": 3}, |
| 1942 | ) |
| 1943 | self.assert_compile( |
| 1944 | c[5:7][3], |
| 1945 | "x[%(x_1)s::INTEGER:%(x_2)s::INTEGER][%(param_1)s::INTEGER]", |
| 1946 | checkparams={"x_2": 7, "x_1": 5, "param_1": 3}, |
| 1947 | ) |
| 1948 | |
| 1949 | self.assert_compile( |
| 1950 | c.contains([1]), |
| 1951 | "x @> %(x_1)s::INTEGER[]", |
| 1952 | checkparams={"x_1": [1]}, |
| 1953 | dialect=PGDialect_psycopg2(), |
| 1954 | ) |
| 1955 | self.assert_compile( |
| 1956 | c.contained_by([2]), |
| 1957 | "x <@ %(x_1)s::INTEGER[]", |
| 1958 | checkparams={"x_1": [2]}, |
| 1959 | dialect=PGDialect_psycopg2(), |
| 1960 | ) |
| 1961 | self.assert_compile( |
| 1962 | c.contained_by([2]), |
| 1963 | "x <@ %(x_1)s", |
| 1964 | checkparams={"x_1": [2]}, |
| 1965 | dialect=PGDialect(), |
| 1966 | ) |
| 1967 | self.assert_compile( |
| 1968 | c.overlap([3]), |
| 1969 | "x && %(x_1)s::INTEGER[]", |
| 1970 | checkparams={"x_1": [3]}, |
| 1971 | dialect=PGDialect_psycopg2(), |
| 1972 | ) |
| 1973 | |
| 1974 | def test_array_modern_any_all(self): |
| 1975 | c = Column("x", postgresql.ARRAY(Integer)) |
nothing calls this directly
no test coverage detected