mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-11-03 18:53:17 -05:00 
			
		
		
		
	* upgrade sqlalchemy to 2.0 * rewrite all db models to sqla 2.0 mapping api * fix some importing and typing weirdness * fix types of a lot of nullable columns * remove get_ref methods * fix issues found by tests * rewrite all queries in repository_recipe to 2.0 style * rewrite all repository queries to 2.0 api * rewrite all remaining queries to 2.0 api * remove now-unneeded __allow_unmapped__ flag * remove and fix some unneeded cases of "# type: ignore" * fix formatting * bump black version * run black * can this please be the last one. okay. just. okay. * fix repository errors * remove return * drop open API validator --------- Co-authored-by: Sören Busch <fleshgolem@gmx.net>
		
			
				
	
	
		
			23 lines
		
	
	
		
			547 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			547 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import pytest
 | 
						|
 | 
						|
from mealie.pkgs.stats.fs_stats import pretty_size
 | 
						|
 | 
						|
 | 
						|
@pytest.mark.parametrize(
 | 
						|
    "size, expected",
 | 
						|
    [
 | 
						|
        (0, "0 bytes"),
 | 
						|
        (1, "1 bytes"),
 | 
						|
        (1024, "1.0 KB"),
 | 
						|
        (1024**2, "1.0 MB"),
 | 
						|
        (1024**2 * 1024, "1.0 GB"),
 | 
						|
        (1024**2 * 1024 * 1024, "1.0 TB"),
 | 
						|
    ],
 | 
						|
)
 | 
						|
def test_pretty_size(size: int, expected: str) -> None:
 | 
						|
    """
 | 
						|
    Test pretty size takes in a integer value of a file size and returns the most applicable
 | 
						|
    file unit and the size.
 | 
						|
    """
 | 
						|
    assert pretty_size(size) == expected
 |