def test_datatest(self): select = datatest.Selector([['A', 'B'], ['x', 1], ['y', 2]]) query = select('A') reader = get_reader(query) self.assertEqual(list(reader), [['A'], ['x'], ['y']]) select = datatest.Selector([['A', 'B'], ['x', 1], ['y', 2]]) query = select({'A': 'B'}) reader = get_reader(query) self.assertEqual(list(reader), [['A', 'B'], ['x', 1], ['y', 2]])
def setUpClass(cls): cls.selector_a = datatest.Selector([ ['A', 'B', 'C'], ['x', 1, 100], ['y', 2, 200], ['z', 3, 300], ]) cls.selector_b = datatest.Selector([ ['A', 'B'], ['x', 1], ['y', 2], ['z', 3], ])
def test_selector_source_column_mapping3(self): select = datatest.Selector([['A', 'B'], ['x', 1], ['x', 2]]) query = select({('A', 'A'): ('B', 'B')}) reader = get_reader.from_query(query) self.assertEqual( list(reader), [['A', 'A', 'B', 'B'], ['x', 'x', 1, 1], ['x', 'x', 2, 2]])
def test_datatest(self): select = datatest.Selector([['A', 'B'], ['x', 1], ['y', 2]]) query = select(('A', 'B')) reader = get_reader(query) # <- datatest.Query self.assertEqual(list(reader), [('A', 'B'), ('x', 1), ('y', 2)]) reader = get_reader(select) # <- datatest.Selector self.assertEqual(list(reader), [('A', 'B'), ('x', 1), ('y', 2)]) result = select({'A': 'B'}).execute() reader = get_reader(query) # <- datatest.Result self.assertEqual(list(reader), [('A', 'B'), ('x', 1), ('y', 2)])
def setUp(self): self.select = datatest.Selector([['A', 'B'], ['x', 1], ['y', 2]])
def test_selector_source_multiple_columns(self): select = datatest.Selector([['A', 'B'], ['x', 1], ['y', 2]]) query = select(('A', 'B')) reader = get_reader.from_query(query) self.assertEqual(list(reader), [['A', 'B'], ['x', 1], ['y', 2]])