MCPcopy Index your code
hub / github.com/clips/pattern / test_group

Method test_group

test/test_db.py:972–983  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

970 print "pattern.db.Datasheet.fields"
971
972 def test_group(self):
973 # Assert Datasheet.group().
974 v1 = db.Datasheet(rows=[[1,2,"a"],[1,3,"b"],[1,4,"c"],[0,0,"d"]])
975 v2 = v1.group(0)
976 v3 = v1.group(0, function=db.LAST)
977 v4 = v1.group(0, function=(db.FIRST, db.COUNT, db.CONCATENATE))
978 v5 = v1.group(0, function=db.CONCATENATE, key=lambda j: j>0)
979 self.assertEqual(v2, [[1,2,"a"], [0,0,"d"]])
980 self.assertEqual(v3, [[1,4,"c"], [0,0,"d"]])
981 self.assertEqual(v4, [[1,3,u"a,b,c"], [0,1,u"d"]])
982 self.assertEqual(v5, [[True,u"2,3,4",u"a,b,c"], [False,u"0",u"d"]])
983 print "pattern.db.Datasheet.group()"
984
985 def test_slice(self):
986 # Assert Datasheet slices.

Callers

nothing calls this directly

Calls 1

groupMethod · 0.95

Tested by

no test coverage detected