Skip to content

Commit

Permalink
Add test coverage for QgsFileUtils' representFileSize function
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Aug 23, 2021
1 parent b171ba1 commit f7ffa42
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/src/python/test_qgsfileutils.py
Expand Up @@ -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
Expand Down

0 comments on commit f7ffa42

Please sign in to comment.