Пример #1
0
 def test_read_file(self):
     valid_path = self.input_file_path
     invalid_path = 'input files//160400487955978.wav'
     not_exist_path = 'input files2/160400487955978'
     not_path = [1,2,3]
     with open(valid_path, 'rb') as file:
         bytes = file.read()
     self.assertEqual(read_file(valid_path),bytes)
     self.assertEqual(read_file(invalid_path),None)
     self.assertIsNone(read_file(not_exist_path),None)
     self.assertIsNone(read_file(not_path),None)
Пример #2
0
def main():
    args = get_parser().parse_args()

    hm = HashtagMaker()

    entries = list_dir(args.dir)
    for filename, filepath in entries:
        text = read_file(filepath)
        hm.load_document(filename, text)

    hashtags = hm.get_most_common(args.count)

    pprint(hashtags)
Пример #3
0
    def test_update_content_in_file( self ):
        assertion_content = {"testing": "file update"}

        self.assertTrue( assertion_content, app.update_file( './test-storage/percist.json', assertion_content ) )
        self.assertEquals( assertion_content, app.read_file( './test-storage/percist.json' ) )
Пример #4
0
    def test_content_read_file( self ):
        assertion_content = {"testing": "file"}

        self.assertEquals( assertion_content, app.read_file( './test-storage/percist.json' ) )