示例#1
0
    def test_get_schema(self, connection):
        pg_base = Base(connection.engine.url.database)

        pair1, pair2 = pg_base._get_schema("public", "public1.my_table")
        assert pair1 == "public1"
        assert pair2 == "my_table"

        pair1, pair2 = pg_base._get_schema("public", "my_table")
        assert pair1 == "public"
        assert pair2 == "my_table"

        with pytest.raises(ValueError) as excinfo:
            pg_base._get_schema("public", "public1.my_table.foo")
            assert "Invalid definition public1.my_table for public" == str(
                excinfo.value)
示例#2
0
    def test_get_schema(self, connection):
        pg_base = Base(connection.engine.url.database)

        pair1, pair2 = pg_base._get_schema('public', 'public1.my_table')
        assert pair1 == 'public1'
        assert pair2 == 'my_table'

        pair1, pair2 = pg_base._get_schema('public', 'my_table')
        assert pair1 == 'public'
        assert pair2 == 'my_table'

        with pytest.raises(ValueError) as excinfo:
            pg_base._get_schema('public', 'public1.my_table.foo')
            assert 'Invalid definition public1.my_table for public' == str(
                excinfo.value)