Skip to content
Permalink
Browse files
Add test coverage for QgsFileUtils' representFileSize function
  • Loading branch information
nirvn committed Aug 23, 2021
1 parent b171ba1 commit f7ffa42a0e1b9d43471ea95d02d8296b3b96102c
Showing with 10 additions and 0 deletions.
  1. +10 −0 tests/src/python/test_qgsfileutils.py
@@ -189,6 +189,16 @@ def testAutoFinder(self):
files = QgsFileUtils.findFile(filename, os.path.join(nest, 'nest2'), 2, 4)
self.assertEqual(files[0], os.path.join(nest, filename).replace(os.sep, '/'))

def test_represent_file_size(self):
"""
Test QgsFileUtils.representFileSize
"""

self.assertEqual(QgsFileUtils.representFileSize(1023), '1023 B')
self.assertEqual(QgsFileUtils.representFileSize(1024), '1 KB')
self.assertEqual(QgsFileUtils.representFileSize(1048576), '1.00 MB')
self.assertEqual(QgsFileUtils.representFileSize(9876543210), '9.20 GB')

def test_sidecar_files_for_path(self):
"""
Test QgsFileUtils.sidecarFilesForPath

0 comments on commit f7ffa42

Please sign in to comment.