11"""
22Test scyjava JVM memory-related functions.
33"""
4+
45import math
6+
57from assertpy import assert_that
68
79import scyjava
@@ -25,11 +27,17 @@ def magnitude(x: int) -> int:
2527mb_total = scyjava .memory_total () // 1024 // 1024
2628mb_used = scyjava .memory_used () // 1024 // 1024
2729
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 )
3137
3238tolerance = pow (10 , magnitude (mb_initial ))
3339
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