'Test for PR#143 from repo.'

def test_issue_143(self):

    pt = partial(point, u'a_serie_name', timestamp=u'2015-03-30T16:16:37Z')
    pts = [pt(value=15), pt(tags={u'tag_1': u'value1'}, value=5), pt(tags={u'tag_1': u'value2'}, value=10)]
    self.cli.write_points(pts)
    time.sleep(1)
    rsp = list(self.cli.query(u'SELECT    *    FROM    a_serie_name    GROUP    BY    tag_1'))
    self.assertEqual([[{u'value': 15, u'time': u'2015-03-30T16:16:37Z'}], [{u'value': 5, u'time': u'2015-03-30T16:16:37Z'}], [{u'value': 10, u'time': u'2015-03-30T16:16:37Z'}]], rsp)
    pt = partial(point, u'serie2', timestamp=u'2015-03-30T16:16:37Z')
    pts = [pt(tags={u'tag1': u'value1', u'tag2': u'v1'}, value=0), pt(tags={u'tag1': u'value1', u'tag2': u'v2'}, value=5), pt(tags={u'tag1': u'value2', u'tag2': u'v1'}, value=10)]
    self.cli.write_points(pts)
    time.sleep(1)
    rsp = self.cli.query(u'SELECT    *    FROM    serie2    GROUP    BY    tag1,tag2')
    self.assertEqual([[{u'value': 0, u'time': u'2015-03-30T16:16:37Z'}], [{u'value': 5, u'time': u'2015-03-30T16:16:37Z'}], [{u'value': 10, u'time': u'2015-03-30T16:16:37Z'}]], list(rsp))
    all_tag2_equal_v1 = list(rsp[(None, {u'tag2': u'v1'})])
    self.assertEqual([{u'value': 0, u'time': u'2015-03-30T16:16:37Z'}, {u'value': 10, u'time': u'2015-03-30T16:16:37Z'}], all_tag2_equal_v1)
