Beispiel #1
0
 def test_replace_kwargs(self):
     """Test simple REPLACE with kwargs."""
     #
     # Taken from mosql:
     #   http://mosql.mosky.tw/query.html#mosql.query.replace
     #
     result = replace2sql(table='person',
                          values=[['person_id', 'mosky'],
                                  ['name', 'Mosky Liu']])
     assert result == "REPLACE INTO \"person\" VALUES ('person_id', 'mosky'), ('name', 'Mosky Liu')"
Beispiel #2
0
 def test_replace_dict(self):
     """Test simple REPLACE."""
     #
     # Taken from mosql:
     #   http://mosql.mosky.tw/query.html#mosql.query.replace
     #
     result = replace2sql({
         'table':
         'person',
         'values': [['person_id', 'mosky'], ['name', 'Mosky Liu']]
     })
     assert result == "REPLACE INTO \"person\" VALUES ('person_id', 'mosky'), ('name', 'Mosky Liu')"
Beispiel #3
0
 def test_replace_set(self):
     """Test replace."""
     result = replace2sql(table='person',
                          set=[['name', 'Milan'], ('age', 42)])
     assert result == "REPLACE INTO \"person\" (\"name\", \"age\") VALUES ('Milan', 42)"
Beispiel #4
0
 def test_replace_multiple(self):
     """Test replace."""
     result = replace2sql(table='person',
                          columns=['name', 'age'],
                          values=['Milan', 42])
     assert result == "REPLACE INTO \"person\" (\"name\", \"age\") VALUES ('Milan', 42)"
Beispiel #5
0
 def test_replace_single(self):
     """Test replace."""
     result = replace2sql(table='person', columns='name', values='foo')
     assert result == "REPLACE INTO \"person\" (\"name\") VALUES foo"