Пример #1
0
    def testStringSource_empty_01(self):
        from datagraph.datasources import StringSource
        data = u''''''
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0)
Пример #2
0
    def testStringSource_empty_01(self):
        from datagraph.datasources import StringSource
        data = ''''''
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0)
Пример #3
0
    def testStringSource_single_03(self):
        from datagraph.datasources import StringSource
        data = '''   123    '''
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 1)
        self.assertEqual(items[0], ['123'])
Пример #4
0
    def testStringSource_single_03(self):
        from datagraph.datasources import StringSource
        data = u'''   123    '''
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 1)
        self.assertEqual(items[0], [u'123'])
Пример #5
0
    def testStringSource_single_02(self):
        from datagraph.datasources import StringSource

        data = u"""123    """
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 1)
        self.assertEqual(items[0], [u"123"])
Пример #6
0
    def testStringSource_skiprows_04(self):
        from datagraph.datasources import StringSource
        data = u'''Абырвалг Абыр
----
123    456    789
234    100      111
456    101    99
'''
        source = StringSource(data, skiprows=5)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0)
Пример #7
0
    def testStringSource_one_col_01(self):
        from datagraph.datasources import StringSource
        data = u'''123
234
456'''
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 3)
        self.assertEqual(items[0], [u'123'])
        self.assertEqual(items[1], [u'234'])
        self.assertEqual(items[2], [u'456'])
Пример #8
0
    def testStringSource_one_col_01(self):
        from datagraph.datasources import StringSource
        data = '''123
234
456'''
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 3)
        self.assertEqual(items[0], ['123'])
        self.assertEqual(items[1], ['234'])
        self.assertEqual(items[2], ['456'])
Пример #9
0
    def testStringSource_skiprows_04(self):
        from datagraph.datasources import StringSource
        data = '''Абырвалг Абыр
----
123    456    789
234    100      111
456    101    99
'''
        source = StringSource(data, skiprows=5)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0)
Пример #10
0
    def testStringSource_col_04(self):
        from datagraph.datasources import StringSource
        data = u'''123    456    789
234    100      111
456    101    99      78
'''
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 2)

        self.assertEqual(items[0], [u'123', u'456', u'789'])
        self.assertEqual(items[1], [u'234', u'100', u'111'])
Пример #11
0
    def testStringSource_one_col_01(self):
        from datagraph.datasources import StringSource

        data = u"""123
234
456"""
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 3)
        self.assertEqual(items[0], [u"123"])
        self.assertEqual(items[1], [u"234"])
        self.assertEqual(items[2], [u"456"])
Пример #12
0
    def testStringSource_col_04(self):
        from datagraph.datasources import StringSource
        data = '''123    456    789
234    100      111
456    101    99      78
'''
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 2)

        self.assertEqual(items[0], ['123', '456', '789'])
        self.assertEqual(items[1], ['234', '100', '111'])
Пример #13
0
    def testStringSource_col_04(self):
        from datagraph.datasources import StringSource

        data = u"""123    456    789
234    100      111
456    101    99      78
"""
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 2)

        self.assertEqual(items[0], [u"123", u"456", u"789"])
        self.assertEqual(items[1], [u"234", u"100", u"111"])
Пример #14
0
    def testStringSource_skiprows_01(self):
        from datagraph.datasources import StringSource
        data = '''
123    456    789
234    100      111
456    101    99
'''
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 3)

        self.assertEqual(items[0], ['123', '456', '789'])
        self.assertEqual(items[1], ['234', '100', '111'])
Пример #15
0
    def testStringSource_skiprows_02(self):
        from datagraph.datasources import StringSource
        data = '''Абырвалг
----
123    456    789
234    100      111
456    101    99
'''
        source = StringSource(data, skiprows=2)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 3)

        self.assertEqual(items[0], ['123', '456', '789'])
        self.assertEqual(items[1], ['234', '100', '111'])
Пример #16
0
    def testStringSource_skiprows_02(self):
        from datagraph.datasources import StringSource
        data = u'''Абырвалг
----
123    456    789
234    100      111
456    101    99
'''
        source = StringSource(data, skiprows=2)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 3)

        self.assertEqual(items[0], [u'123', u'456', u'789'])
        self.assertEqual(items[1], [u'234', u'100', u'111'])
Пример #17
0
    def testStringSource_skiprows_03(self):
        from datagraph.datasources import StringSource

        data = u"""Абырвалг Абыр
----
123    456    789
234    100      111
456    101    99
"""
        source = StringSource(data, skiprows=0)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 1)

        self.assertEqual(items[0], [u"Абырвалг", u"Абыр"])
Пример #18
0
    def testStringSource_skiprows_02(self):
        from datagraph.datasources import StringSource

        data = u"""Абырвалг
----
123    456    789
234    100      111
456    101    99
"""
        source = StringSource(data, skiprows=2)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 3)

        self.assertEqual(items[0], [u"123", u"456", u"789"])
        self.assertEqual(items[1], [u"234", u"100", u"111"])
Пример #19
0
    def testStringSource_col_01(self):
        from datagraph.datasources import StringSource
        data = u'''123    456    789
234    100      111
456    101   99
-10\t55    66
20    30    40    '''
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 5)

        self.assertEqual(items[0], [u'123', u'456', u'789'])
        self.assertEqual(items[1], [u'234', u'100', u'111'])
        self.assertEqual(items[2], [u'456', u'101', u'99'])
        self.assertEqual(items[3], [u'-10', u'55', u'66'])
        self.assertEqual(items[4], [u'20', u'30', u'40'])
Пример #20
0
    def testStringSource_col_01(self):
        from datagraph.datasources import StringSource
        data = '''123    456    789
234    100      111
456    101   99
-10\t55    66
20    30    40    '''
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 5)

        self.assertEqual(items[0], ['123', '456', '789'])
        self.assertEqual(items[1], ['234', '100', '111'])
        self.assertEqual(items[2], ['456', '101', '99'])
        self.assertEqual(items[3], ['-10', '55', '66'])
        self.assertEqual(items[4], ['20', '30', '40'])
Пример #21
0
    def testStringSource_col_01(self):
        from datagraph.datasources import StringSource

        data = u"""123    456    789
234    100      111
456    101   99
-10\t55    66
20    30    40    """
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 5)

        self.assertEqual(items[0], [u"123", u"456", u"789"])
        self.assertEqual(items[1], [u"234", u"100", u"111"])
        self.assertEqual(items[2], [u"456", u"101", u"99"])
        self.assertEqual(items[3], [u"-10", u"55", u"66"])
        self.assertEqual(items[4], [u"20", u"30", u"40"])
Пример #22
0
    def testStringSource_one_col_04(self):
        from datagraph.datasources import StringSource
        data = '''
    
123
234
4560

1000
'''
        source = StringSource(data)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 4)
        self.assertEqual(items[0], ['123'])
        self.assertEqual(items[1], ['234'])
        self.assertEqual(items[2], ['4560'])
        self.assertEqual(items[3], ['1000'])