示例#1
0
    def test_Tables_KnownAccessFile(self):
        import pymdbbin
        result = pymdbbin.parsefile_table_dictionary(accessfile)

        self.assertTrue(
            result == {
                'Table2': {
                    'headers': ['ID', 'Field1'],
                    'data': [['1', 'Thing 1'], ['2', 'Thing 2'],
                             ['3', 'Thing 3']]
                },
                'Table3': {
                    'headers': ['ID', 'Field1'],
                    'data': [['1', 'Thing 1'], ['2', 'Thing 2'],
                             ['3', 'Thing 3']]
                },
                'Table1': {
                    'headers': ['ID', 'Field1'],
                    'data': [['1', 'Thing 1'], ['2', 'Thing 2'],
                             ['3', 'Thing 3']]
                }
            })
        self.assertTrue("Table1" in result.keys())
        self.assertTrue("Table2" in result.keys())
        self.assertTrue("Table3" in result.keys())

        for entry in result.keys():
            headercount = len(result[entry]["headers"])
            self.assertTrue(len(result[entry]['data']) >= 3)
            for element in result[entry]['data']:
                self.assertTrue(len(element) >= 2)
                self.assertTrue(len(element) == headercount)
示例#2
0
 def test_Tables_KnownAccessFile(self):
     import pymdbbin
     result = pymdbbin.parsefile_table_dictionary(accessfile)
         
         
     self.assertTrue(
         result == {
             'Table2': {'headers': ['ID','Field1'], 'data': [['1', 'Thing 1'], ['2', 'Thing 2'], ['3', 'Thing 3']]}, 
             'Table3': {'headers': ['ID','Field1'], 'data': [['1', 'Thing 1'], ['2', 'Thing 2'], ['3', 'Thing 3']]}, 
             'Table1': {'headers': ['ID','Field1'], 'data': [['1', 'Thing 1'], ['2', 'Thing 2'], ['3', 'Thing 3']]}
         }
     )
     self.assertTrue( "Table1" in result.keys())
     self.assertTrue( "Table2" in result.keys())
     self.assertTrue( "Table3" in result.keys())
     
     for entry in result.keys():
         headercount = len(result[entry]["headers"])
         self.assertTrue( len(result[entry]['data'] ) >= 3 )
         for element in result[entry]['data']:
             self.assertTrue( len(element) >= 2 )
             self.assertTrue( len(element) == headercount )
示例#3
0
文件: pymdb.py 项目: sofair/pymdb
def parsefile(file, parsestrategy=PymdbStrategy.table_dictionary):
    if(parsestrategy==PymdbStrategy.table_dictionary):
        return pymdbbin.parsefile_table_dictionary(file)
    return None
示例#4
0
 def test_parsefile_Returns_Dictionary_Contains_Dictionaries(self):
     import pymdbbin
     result = pymdbbin.parsefile_table_dictionary(accessfile)
     
     for entry in result.keys():
         self.assertIsInstance(result[entry], dict)
示例#5
0
 def test_parsefile_Returns_Dictionary_Keys(self):
     import pymdbbin
     result = pymdbbin.parsefile_table_dictionary(accessfile)
     
     for entry in result.keys():
         self.assertIsInstance(entry, str)
示例#6
0
 def test_parsefile_Returns_Dictionary(self):
     import pymdbbin
     result = pymdbbin.parsefile_table_dictionary(accessfile)
     self.assertIsInstance(result, dict)
示例#7
0
 def test_parsefile_Returns_Tables(self):
     import pymdbbin
     result = pymdbbin.parsefile_table_dictionary(accessfile)
     self.assertGreater(len(result.keys()), 0)
示例#8
0
 def test_parsefile_Runs(self):
     import pymdbbin
     result = pymdbbin.parsefile_table_dictionary(accessfile)
     self.assertIsNotNone(result)
示例#9
0
文件: pymdb.py 项目: gumpyoung/pymdb
def parsefile(file, parsestrategy=PymdbStrategy.table_dictionary):
    if parsestrategy == PymdbStrategy.table_dictionary:
        return pymdbbin.parsefile_table_dictionary(file)
    return None
示例#10
0
    def test_parsefile_Returns_Dictionary_Contains_Dictionaries(self):
        import pymdbbin
        result = pymdbbin.parsefile_table_dictionary(accessfile)

        for entry in result.keys():
            self.assertIsInstance(result[entry], dict)
示例#11
0
    def test_parsefile_Returns_Dictionary_Keys(self):
        import pymdbbin
        result = pymdbbin.parsefile_table_dictionary(accessfile)

        for entry in result.keys():
            self.assertIsInstance(entry, str)
示例#12
0
 def test_parsefile_Returns_Dictionary(self):
     import pymdbbin
     result = pymdbbin.parsefile_table_dictionary(accessfile)
     self.assertIsInstance(result, dict)
示例#13
0
 def test_parsefile_Returns_Tables(self):
     import pymdbbin
     result = pymdbbin.parsefile_table_dictionary(accessfile)
     self.assertGreater(len(result.keys()), 0)
示例#14
0
 def test_parsefile_Runs(self):
     import pymdbbin
     result = pymdbbin.parsefile_table_dictionary(accessfile)
     self.assertIsNotNone(result)