OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tests.test_cursor.TestCursor Class Reference

Public Member Functions

def test_empty_iterable
 
def test_escape_basic
 
def test_escape_malicious
 
def test_arraysize
 

Detailed Description

Definition at line 20 of file test_cursor.py.

Member Function Documentation

def tests.test_cursor.TestCursor.test_arraysize (   self)

Definition at line 39 of file test_cursor.py.

39 
40  def test_arraysize(self):
41  c = Cursor(None)
42  assert c.arraysize == 1
43  c.arraysize = 10
44  assert c.arraysize == 10
45 
46  with pytest.raises(TypeError):
47  c.arraysize = 'a'
def tests.test_cursor.TestCursor.test_empty_iterable (   self)

Definition at line 21 of file test_cursor.py.

21 
22  def test_empty_iterable(self):
23  c = Cursor(None)
24  result = list(c)
25  assert result == []
def tests.test_cursor.TestCursor.test_escape_basic (   self)

Definition at line 26 of file test_cursor.py.

References heavydb._parsers._bind_parameters().

26 
27  def test_escape_basic(self):
28  query = "select * from foo where bar > :baz"
29  result = str(_bind_parameters(query, {"baz": 10}))
30  expected = 'select * from foo where bar > 10'
31  assert result == expected
def _bind_parameters
Definition: _parsers.py:162

+ Here is the call graph for this function:

def tests.test_cursor.TestCursor.test_escape_malicious (   self)

Definition at line 32 of file test_cursor.py.

References heavydb._parsers._bind_parameters().

32 
33  def test_escape_malicious(self):
34  query = "select * from foo where bar > :baz"
35  result = str(_bind_parameters(query, {"baz": '1; drop table foo'}))
36  # note the inner quotes
37  expected = "select * from foo where bar > '1; drop table foo'"
38  assert result == expected
def _bind_parameters
Definition: _parsers.py:162

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: