Beispiel #1
0
    def test_radd(self):
        self.insert_row()

        Band.update({Band.name: "!!!" + Band.name}, force=True).run_sync()

        response = Band.select(Band.name).first().run_sync()

        self.assertEqual(response["name"], "!!!Pythonistas")
Beispiel #2
0
    def test_add(self):
        self.insert_row()

        Band.update({
            Band.popularity: Band.popularity + 10
        }, force=True).run_sync()

        response = Band.select(Band.popularity).first().run_sync()

        self.assertEqual(response["popularity"], 1010)
Beispiel #3
0
    def test_update_values_with_kwargs(self):
        """
        Make sure updating work, when passing the new values via kwargs.
        """
        self.insert_rows()

        Band.update().values(name="Pythonistas3").where(
            Band.name == "Pythonistas").run_sync()

        self.check_response()
Beispiel #4
0
    def test_rmul(self):
        self.insert_row()

        Band.update({
            Band.popularity: 2 * Band.popularity
        }, force=True).run_sync()

        response = Band.select(Band.popularity).first().run_sync()

        self.assertEqual(response["popularity"], 2000)
Beispiel #5
0
    def test_update_values_with_string_keys(self):
        """
        Make sure updating work, when passing the new values via the `values`
        method, using a column name as a dictionary key.
        """
        self.insert_rows()

        Band.update().values({
            "name": "Pythonistas3"
        }).where(Band.name == "Pythonistas").run_sync()

        self.check_response()
Beispiel #6
0
    def test_update_values(self):
        """
        Make sure updating work, when passing the new values via the `values`
        method.
        """
        self.insert_rows()

        Band.update().values({
            Band.name: "Pythonistas3"
        }).where(Band.name == "Pythonistas").run_sync()

        self.check_response()
Beispiel #7
0
    def test_update_with_string_keys(self):
        """
        Make sure updating work, when passing a dictionary of values, which
        uses column names as keys, instead of Column instances.
        """
        self.insert_rows()

        Band.update({
            "name": "Pythonistas3"
        }).where(Band.name == "Pythonistas").run_sync()

        self.check_response()