def test_to_string_no_prefix(self): # Setup test objects test_repo = ConvertRepo() test_type = ConvertType(test_repo, "test_type") test_type.base_unit = ConvertUnit(test_type, ["base_unit"], 1) test_type.decimals = 3 test_unit = ConvertUnit(test_type, ["name1", "name2"], 1337) measure1 = ConvertMeasure(17.5, test_unit) # Get string measure_str = measure1.to_string() # Check assert str(measure1) == measure_str assert measure_str == "17.500 name1"
def test_to_string(self): # Setup test objects test_repo = ConvertRepo() test_type = ConvertType(test_repo, "test_type") test_type.base_unit = ConvertUnit(test_type, ["base_unit"], 1) test_type.decimals = 3 test_unit = ConvertUnit(test_type, ["name1", "name2"], 1337) prefix_group = ConvertPrefixGroup(test_repo, "test_group") test_prefix = ConvertPrefix(prefix_group, "ten", "10", 10) prefix_group.add_prefix(test_prefix) test_unit.valid_prefix_group = prefix_group measure1 = ConvertMeasure(17.5, test_unit) # Get string measure_str = measure1.to_string() # Check assert str(measure1) == measure_str assert measure_str == "1.750 tenname1"