def test_namedtuple(self): MyClass = util.namedtuple("MyClass", "a b c", "My Docstring") m = MyClass(1, 2, 3) self.assertEquals(m.__doc__, "My Docstring") self.assertEquals((m.a, m.b, m.c), (1, 2, 3))
import string import random import weakref from miro import app from miro import schema from miro import signals from miro import util from miro.data import item ItemTrackerCondition = util.namedtuple( "ItemTrackerCondition", "table column sql values", """ItemTrackerCondition defines one term for the WHERE clause of a query. :attribute table: table that contains column :attribute column: column that this condition refers to. If this changes in the DB, then we should re-run the query. :attribute sql: sql string for the clause :attribute values: list of values to use to fill in sql """, ) ItemTrackerOrderBy = util.namedtuple( "ItemTrackerOrderBy", "table column collation descending", """ItemTrackerOrderBy defines one term for the ORDER BY clause of a query. :attribute table: table that contains column :attribute column: column to sort on :attribute collation: collation to use :attribute descending: should we add the DESC clause?
import string import random import weakref from miro import app from miro import schema from miro import signals from miro import util from miro.data import item ItemTrackerCondition = util.namedtuple( "ItemTrackerCondition", "table column sql values", """ItemTrackerCondition defines one term for the WHERE clause of a query. :attribute table: table that contains column :attribute column: column that this condition refers to. If this changes in the DB, then we should re-run the query. :attribute sql: sql string for the clause :attribute values: list of values to use to fill in sql """) ItemTrackerOrderBy = util.namedtuple( "ItemTrackerOrderBy", "table column collation descending", """ItemTrackerOrderBy defines one term for the ORDER BY clause of a query. :attribute table: table that contains column :attribute column: column to sort on :attribute collation: collation to use
from miro import app from miro import models from miro import prefs from miro import schema from miro import signals from miro import util from miro.data import item from miro.gtcache import gettext as _ ItemTrackerCondition = util.namedtuple( "ItemTrackerCondition", "columns sql values", """ItemTrackerCondition defines one term for the WHERE clause of a query. :attribute columns: list of (table, column) tuples that that this condition refers to. If any of these change in the DB, then we should re-run the query. :attribute sql: sql string for the clause :attribute values: list of values to use to fill in sql """) ItemTrackerOrderBy = util.namedtuple( "ItemTrackerOrderBy", "columns sql", """ItemTrackerOrderBy defines one term for the ORDER BY clause of a query. :attribute columns: list of (table, column) tuples used in the query :attribute sql: sql expression """)
def test_namedtuple(self): MyClass = util.namedtuple("MyClass", "a b c", "My Docstring") m = MyClass(1,2,3) self.assertEquals(m.__doc__, "My Docstring") self.assertEquals((m.a, m.b, m.c), (1,2,3))