tests Package

tests Package

mqlalchemy.tests.__init__

Tests for our new query syntax.

copyright:(c) 2016 by Nicholas Repole and contributors. See AUTHORS for more details.
license:MIT - See LICENSE for more details.
class mqlalchemy.tests.MQLAlchemyTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

A collection of MQLAlchemy tests.

setUp()[source]

Configure a db session for the chinook database.

test_bad_operator_fail()[source]

Test that a invalid operator fails.

test_complex_convert_name()[source]

Test that converting from camelCase to underscore works.

test_complex_list_relation()[source]

Test that a multi-level list relation query works.

test_convert_fail()[source]

Test that convert_to_alchemy_type properly fails.

test_convert_to_bool()[source]

Test that we can convert a value to a boolean.

test_convert_to_date()[source]

Test that we can convert a value to a date.

test_convert_to_datetime()[source]

Test that we can convert a value to a datetime.

test_convert_to_float()[source]

Test that we can convert a string to a float.

test_convert_to_int()[source]

Test that we can convert a string to integer.

test_convert_to_null()[source]

Test that convert_to_alchemy_type properly returns None.

test_convert_to_string()[source]

Test that we can convert a string to integer.

test_convert_to_time()[source]

Test that we can convert a value to a time.

test_custom_whitelist_func()[source]

Test that providing a whitelist function works.

test_db()[source]

Make sure our test db is functional.

test_elemmatch_fail()[source]

Test that the $elemMatch operator properly fails.

test_empty_dict_fail()[source]

Test that a nested attribute query fails.

test_eq()[source]

Test that the new $eq operator works.

test_explicit_and()[source]

Test that the $and operator works.

test_explicit_elemmatch()[source]

Test that an explicit elemMatch.

test_get_attr_class_attributes()[source]

Test that _get_class_attributes works.

test_gt()[source]

Test that the $gt operator works.

test_gte()[source]

Test that the $gte operator works.

test_implicit_and()[source]

Test that an implicit and query works.

test_in()[source]

Test that the $in operator works.

test_like()[source]

Test that the new $like operator works.

test_list_relation()[source]

Test that a list relation .any query works.

test_list_relation_fail()[source]

Make sure we can’t check a relation for equality.

test_lt()[source]

Test that the $lt operator works.

test_lte()[source]

Test that the $lte operator works.

test_mod()[source]

Test that the $mod operator works.

test_more_complex_list_relation()[source]

Test that a complex list relation query works.

test_negation()[source]

Test that the $not operator works.

test_neq()[source]

Test that the $ne operator works.

test_nested_attr_query_fail()[source]

Test that a nested attribute query fails.

test_nin()[source]

Test that the $nin operator works.

test_no_match()[source]

Test that a query that should have no match works.

test_non_list_relation()[source]

Test that a non-list relation .has query works.

test_nor()[source]

Test that the $nor operator works.

test_or()[source]

Test that the $or operator works.

test_simple_prior_query()[source]

Test a simple mqlalchemy query using a preformed query.

test_simple_query()[source]

Test a very simple mqlalchemy query.

test_stack_size_limit()[source]

Make sure that limiting the stack size works as expected.

test_whitelist()[source]

Test that whitelisting works as expected.

models Module

mqlalchemy.tests.models.py

SQLAlchemy models for the Chinook database.

copyright:(c) 2016 by Nicholas Repole and contributors. See AUTHORS for more details.
license:MIT - See LICENSE for more details.
class mqlalchemy.tests.models.Album(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

SQLAlchemy model for the Album table in our database.

album_id
artist
artist_id
title
class mqlalchemy.tests.models.Artist(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

SQLAlchemy model for the Artist table in our database.

artist_id
name
class mqlalchemy.tests.models.Customer(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

SQLAlchemy model for the Customer table in our database.

address
city
company
country
customer_id
email
employee
fax
first_name
last_name
phone
postal_code
state
support_rep_id
class mqlalchemy.tests.models.Employee(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

SQLAlchemy model for the Employee table in our database.

address
birth_date
city
country
email
employee_id
fax
first_name
hire_date
last_name
parent
phone
postal_code
reports_to
state
title
class mqlalchemy.tests.models.Genre(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

SQLAlchemy model for the Genre table in our database.

genre_id
name
class mqlalchemy.tests.models.Invoice(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

SQLAlchemy model for the Invoice table in our database.

billing_address
billing_city
billing_country
billing_postal_code
billing_state
customer
customer_id
invoice_date
invoice_id
total
class mqlalchemy.tests.models.InvoiceLine(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

SQLAlchemy model for the InvoiceLine table in our database.

invoice
invoice_id
invoice_line_id
quantity
track
track_id
unit_price
class mqlalchemy.tests.models.MediaType(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

SQLAlchemy model for the MediaType table in our database.

media_type_id
name
class mqlalchemy.tests.models.Playlist(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

SQLAlchemy model for the Playlist table in our database.

name
playlist_id
tracks
class mqlalchemy.tests.models.Track(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

SQLAlchemy model for the Track table in our database.

album
album_id
bytes
composer
genre
genre_id
media_type
media_type_id
milliseconds
name
track_id
unit_price