1
1
"""
2
2
Test scyjava JVM memory-related functions.
3
3
"""
4
+
4
5
import math
6
+
5
7
from assertpy import assert_that
6
8
7
9
import scyjava
@@ -25,11 +27,17 @@ def magnitude(x: int) -> int:
25
27
mb_total = scyjava .memory_total () // 1024 // 1024
26
28
mb_used = scyjava .memory_used () // 1024 // 1024
27
29
28
- assert_that (mb_used , 'Used memory should be less than the current memory total' ).is_less_than_or_equal_to (mb_total )
29
- assert_that (mb_total , 'current memory total should be less than maximum memory' ).is_less_than_or_equal_to (mb_max )
30
- assert_that (mb_max , 'maximum heap size should be approx. 1 GB' ).is_between (900 , 1024 )
30
+ assert_that (
31
+ mb_used , "Used memory should be less than the current memory total"
32
+ ).is_less_than_or_equal_to (mb_total )
33
+ assert_that (
34
+ mb_total , "current memory total should be less than maximum memory"
35
+ ).is_less_than_or_equal_to (mb_max )
36
+ assert_that (mb_max , "maximum heap size should be approx. 1 GB" ).is_between (900 , 1024 )
31
37
32
38
tolerance = pow (10 , magnitude (mb_initial ))
33
39
34
- assert_that (mb_used , 'most memory should be available' ).is_less_than (tolerance )
35
- assert_that (mb_total , 'total memory should be close to initial' ).is_close_to (mb_initial , tolerance = tolerance )
40
+ assert_that (mb_used , "most memory should be available" ).is_less_than (tolerance )
41
+ assert_that (mb_total , "total memory should be close to initial" ).is_close_to (
42
+ mb_initial , tolerance = tolerance
43
+ )
0 commit comments