Exemplo n.º 1
0
 def test_select_from_none(self):
     with SessionContext(self.graph):
         with transient(Company) as transient_company:
             assert_that(
                 transient_company.select_from(Company),
                 contains(),
             )
 def test_select_from_none(self):
     with SessionContext(self.graph):
         with transient(Company) as transient_company:
             assert_that(
                 transient_company.select_from(Company),
                 contains(),
             )
Exemplo n.º 3
0
    def test_select_from_partial(self):
        with SessionContext(self.graph):
            with transaction():
                with transient(Company) as transient_company:
                    transient_company.insert_many(self.companies)
                    self.companies[0].create()
                    transient_company.upsert_into(Company)

                assert_that(
                    transient_company.select_from(Company),
                    contains(
                        has_properties(name="name2", ),
                        has_properties(name="name3", ),
                    ))
    def test_select_from_partial(self):
        with SessionContext(self.graph):
            with transaction():
                with transient(Company) as transient_company:
                    transient_company.insert_many(self.companies)
                    self.companies[0].create()
                    transient_company.upsert_into(Company)

                assert_that(
                    transient_company.select_from(Company),
                    contains(
                        has_properties(
                            name="name2",
                        ),
                        has_properties(
                            name="name3",
                        ),
                    )
                )
Exemplo n.º 5
0
    def test_upsert_into(self):
        with SessionContext(self.graph):
            with transaction():
                # NB: create() will set the id of companies[0]
                self.companies[0].create()

            with transaction():
                with transient(Company) as transient_company:
                    assert_that(
                        transient_company.insert_many(self.companies),
                        is_(equal_to(3)),
                    )
                    assert_that(
                        transient_company.upsert_into(Company),
                        is_(equal_to(2)),
                    )
                    assert_that(
                        self.company_store.count(),
                        is_(equal_to(3)),
                    )
    def test_upsert_into(self):
        with SessionContext(self.graph):
            with transaction():
                # NB: create() will set the id of companies[0]
                self.companies[0].create()

            with transaction():
                with transient(Company) as transient_company:
                    assert_that(
                        transient_company.insert_many(self.companies),
                        is_(equal_to(3)),
                    )
                    assert_that(
                        transient_company.upsert_into(Company),
                        is_(equal_to(2)),
                    )
                    assert_that(
                        self.company_store.count(),
                        is_(equal_to(3)),
                    )