Exemplo n.º 1
0
    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]])
Exemplo n.º 2
0
 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],
     ])
Exemplo n.º 3
0
 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]])
Exemplo n.º 4
0
    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)])
Exemplo n.º 5
0
 def setUp(self):
     self.select = datatest.Selector([['A', 'B'], ['x', 1], ['y', 2]])
Exemplo n.º 6
0
 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]])