コード例 #1
0
ファイル: datasources.py プロジェクト: theoden-dd/outwiker
    def testFileSource_invalid_01(self):
        from datagraph.datasources import FileSource

        source = FileSource(u"invalid_fname.txt")

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0)
コード例 #2
0
ファイル: datasources.py プロジェクト: theoden-dd/outwiker
    def testFileSource_invalid_04(self):
        from datagraph.datasources import FileSource

        source = FileSource(u"../test/samplefiles/text_1251.txt")

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0)
コード例 #3
0
ファイル: test_datasources.py プロジェクト: Jenyay/outwiker
    def testFileSource_empty_01(self):
        from datagraph.datasources import FileSource
        data = ''''''

        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0, items)
コード例 #4
0
ファイル: test_datasources.py プロジェクト: Jenyay/outwiker
    def testFileSource_single_03(self):
        from datagraph.datasources import FileSource
        data = '''   123    '''
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 1)
        self.assertEqual(items[0], ['123'])
コード例 #5
0
    def testFileSource_empty_01(self):
        from datagraph.datasources import FileSource
        data = u''''''

        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0, items)
コード例 #6
0
    def testFileSource_single_03(self):
        from datagraph.datasources import FileSource
        data = u'''   123    '''
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 1)
        self.assertEqual(items[0], [u'123'])
コード例 #7
0
ファイル: test_datasources.py プロジェクト: Jenyay/outwiker
    def testFileSource_one_col_01(self):
        from datagraph.datasources import FileSource
        data = '''123
234
456'''
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 3)
        self.assertEqual(items[0], ['123'])
        self.assertEqual(items[1], ['234'])
        self.assertEqual(items[2], ['456'])
コード例 #8
0
    def testFileSource_one_col_01(self):
        from datagraph.datasources import FileSource
        data = u'''123
234
456'''
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

        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'])
コード例 #9
0
    def testFileSource_skiprows_04(self):
        from datagraph.datasources import FileSource
        data = u'''Абырвалг Абыр
----
123    456    789
234    100      111
456    101    99
'''
        self._dataFile.write(data.encode(u"utf8"))
        self._dataFile.flush()
        source = FileSource(self._dataFile.name, skiprows=5)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0)
コード例 #10
0
ファイル: test_datasources.py プロジェクト: Jenyay/outwiker
    def testFileSource_skiprows_04(self):
        from datagraph.datasources import FileSource
        data = '''Абырвалг Абыр
----
123    456    789
234    100      111
456    101    99
'''
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name, skiprows=5)

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0)
コード例 #11
0
ファイル: test_datasources.py プロジェクト: Jenyay/outwiker
    def testFileSource_col_04(self):
        from datagraph.datasources import FileSource
        data = '''123    456    789
234    100      111
456    101    99      78
'''
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

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

        self.assertEqual(items[0], ['123', '456', '789'])
        self.assertEqual(items[1], ['234', '100', '111'])
コード例 #12
0
ファイル: datasources.py プロジェクト: theoden-dd/outwiker
    def testFileSource_one_col_01(self):
        from datagraph.datasources import FileSource

        data = u"""123
234
456"""
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

        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"])
コード例 #13
0
    def testFileSource_col_04(self):
        from datagraph.datasources import FileSource
        data = u'''123    456    789
234    100      111
456    101    99      78
'''
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

        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
ファイル: datasources.py プロジェクト: theoden-dd/outwiker
    def testFileSource_col_04(self):
        from datagraph.datasources import FileSource

        data = u"""123    456    789
234    100      111
456    101    99      78
"""
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

        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"])
コード例 #15
0
    def testFileSource_skiprows_03(self):
        from datagraph.datasources import FileSource
        data = '''Абырвалг Абыр
----
123    456    789
234    100      111
456    101    99
'''
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name, skiprows=0)

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

        self.assertEqual(items[0], ['Абырвалг', 'Абыр'])
コード例 #16
0
    def testFileSource_skiprows_01(self):
        from datagraph.datasources import FileSource
        data = '''
123    456    789
234    100      111
456    101    99
'''
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

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

        self.assertEqual(items[0], ['123', '456', '789'])
        self.assertEqual(items[1], ['234', '100', '111'])
コード例 #17
0
    def testFileSource_skiprows_02(self):
        from datagraph.datasources import FileSource
        data = u'''Абырвалг
----
123    456    789
234    100      111
456    101    99
'''
        self._dataFile.write(data.encode(u"utf8"))
        self._dataFile.flush()
        source = FileSource(self._dataFile.name, 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'])
コード例 #18
0
ファイル: datasources.py プロジェクト: theoden-dd/outwiker
    def testFileSource_skiprows_03(self):
        from datagraph.datasources import FileSource

        data = u"""Абырвалг Абыр
----
123    456    789
234    100      111
456    101    99
"""
        self._dataFile.write(data.encode(u"utf8"))
        self._dataFile.flush()
        source = FileSource(self._dataFile.name, skiprows=0)

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

        self.assertEqual(items[0], [u"Абырвалг", u"Абыр"])
コード例 #19
0
ファイル: test_datasources.py プロジェクト: Jenyay/outwiker
    def testFileSource_skiprows_02(self):
        from datagraph.datasources import FileSource
        data = '''Абырвалг
----
123    456    789
234    100      111
456    101    99
'''
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name, 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'])
コード例 #20
0
ファイル: datasources.py プロジェクト: theoden-dd/outwiker
    def testFileSource_skiprows_02(self):
        from datagraph.datasources import FileSource

        data = u"""Абырвалг
----
123    456    789
234    100      111
456    101    99
"""
        self._dataFile.write(data.encode(u"utf8"))
        self._dataFile.flush()
        source = FileSource(self._dataFile.name, 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"])
コード例 #21
0
    def testFileSource_col_01(self):
        from datagraph.datasources import FileSource
        data = u'''123    456    789
234    100      111
456    101   99
-10\t55    66
20    30    40    '''
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

        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
ファイル: test_datasources.py プロジェクト: Jenyay/outwiker
    def testFileSource_col_01(self):
        from datagraph.datasources import FileSource
        data = '''123    456    789
234    100      111
456    101   99
-10\t55    66
20    30    40    '''
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

        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'])
コード例 #23
0
ファイル: datasources.py プロジェクト: theoden-dd/outwiker
    def testFileSource_col_01(self):
        from datagraph.datasources import FileSource

        data = u"""123    456    789
234    100      111
456    101   99
-10\t55    66
20    30    40    """
        self._dataFile.write(data)
        self._dataFile.flush()
        source = FileSource(self._dataFile.name)

        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"])
コード例 #24
0
ファイル: test_datasources.py プロジェクト: Jenyay/outwiker
    def testFileSource_invalid_03(self):
        from datagraph.datasources import FileSource
        source = FileSource('../test/samplefiles/invalid.exe')

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0)
コード例 #25
0
    def testFileSource_invalid_04(self):
        from datagraph.datasources import FileSource
        source = FileSource(u'../test/samplefiles/text_1251.txt')

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0)
コード例 #26
0
    def testFileSource_invalid_01(self):
        from datagraph.datasources import FileSource
        source = FileSource(u'invalid_fname.txt')

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0)
コード例 #27
0
    def testFileSource_invalid_03(self):
        from datagraph.datasources import FileSource
        source = FileSource('testdata/samplefiles/invalid.exe')

        items = list(source.getRowsIterator())
        self.assertEqual(len(items), 0)
コード例 #28
0
    def testFileSource_invalid_02(self):
        from datagraph.datasources import FileSource
        source = FileSource('../test/samplefiles/image.png')

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