name = "List grid demo" description = """\ This table shows a basic grid generated from lists - it has customized order of columns.""" def get_grid(self): """ basic demo """ g = ListGrid(list_data, columns=[1, 3, 2, 0], column_labels=["One", "Three", "Two", "Zero"]) return g demos = subclasses_only(_DemoBase, globals()) #demos = [BasicDemo, CustomColumnDemo] #### Utility functions #### def url(urlpath, **params): # This should be a helper and I think it's defined somewhere but I # can't think of where. return urlpath + "?" + urllib.parse.urlencode(params) def write_file(dir, filename, content): print("... writing '%s'" % filename) path = os.path.join(dir, filename) f = open(path, "w")
def test_subclasses_only_with_exclude(): subclasses = subclasses_only(Tea, globals(), [Black, Green]) subclasses.sort(key=by_name) control = [EarlGrey, EnglishBreakfast, JasminePearl, Sencha] eq_(subclasses, control)
class ListDemo(_DemoBase): name = "List grid demo" description = """\ This table shows a basic grid generated from lists - it has customized order of columns.""" def get_grid(self): """ basic demo """ g = ListGrid(list_data, columns=[1, 3, 2, 0], column_labels=["One", "Three", "Two", "Zero"]) return g demos = subclasses_only(_DemoBase, globals()) #demos = [BasicDemo, CustomColumnDemo] #### Utility functions #### def url(urlpath, **params): # This should be a helper and I think it's defined somewhere but I # can't think of where. return urlpath + "?" + urllib.urlencode(params) def write_file(dir, filename, content): print "... writing '%s'" % filename path = os.path.join(dir, filename) f = open(path, "w") f.write(content) f.close()
def test_subclasses_only(): subclasses = subclasses_only(DummyBase, globals()) subclasses.sort(key=by_name) control = [Subclass1, Subclass2] eq_(subclasses, control)