• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

iplweb / bpp / ba6f9e1f-4683-40a1-aae1-40dd0fcb64e3

25 Aug 2025 06:57PM UTC coverage: 43.284% (+0.6%) from 42.715%
ba6f9e1f-4683-40a1-aae1-40dd0fcb64e3

push

circleci

mpasternak
Merge branch 'release/v202508.1208'

77 of 961 new or added lines in 27 files covered. (8.01%)

731 existing lines in 54 files now uncovered.

17273 of 39906 relevant lines covered (43.28%)

0.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

29.03
src/bpp/tests/test_fields.py
NEW
1
from decimal import Decimal
1✔
2

NEW
3
import pytest
1✔
NEW
4
from django.core.exceptions import ValidationError
1✔
5

NEW
6
from bpp.fields import CommaDecimalField
1✔
7

8

NEW
9
def test_fields_CommaDecimalField_accepts_decimal_with_period():
1✔
10
    """Test that field accepts decimal with period separator"""
NEW
11
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
12
    result = field.to_python("10.50")
×
NEW
13
    assert result == Decimal("10.50")
×
14

15

NEW
16
def test_fields_CommaDecimalField_accepts_decimal_with_comma():
1✔
17
    """Test that field accepts decimal with comma separator"""
NEW
18
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
19
    result = field.to_python("10,50")
×
NEW
20
    assert result == Decimal("10.50")
×
21

22

NEW
23
def test_fields_CommaDecimalField_period_and_comma_produce_same_result():
1✔
24
    """Test that period and comma separators produce identical results"""
NEW
25
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
26
    result_period = field.to_python("10.50")
×
NEW
27
    result_comma = field.to_python("10,50")
×
NEW
28
    assert result_period == result_comma
×
29

30

NEW
31
def test_fields_CommaDecimalField_accepts_integer_as_string():
1✔
32
    """Test that field accepts integer values as strings"""
NEW
33
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
34
    result = field.to_python("10")
×
NEW
35
    assert result == Decimal("10")
×
36

37

NEW
38
def test_fields_CommaDecimalField_accepts_decimal_object():
1✔
39
    """Test that field accepts Decimal objects directly"""
NEW
40
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
41
    decimal_value = Decimal("10.50")
×
NEW
42
    result = field.to_python(decimal_value)
×
NEW
43
    assert result == decimal_value
×
44

45

NEW
46
def test_fields_CommaDecimalField_accepts_float():
1✔
47
    """Test that field accepts float values"""
NEW
48
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
49
    result = field.to_python(10.50)
×
NEW
50
    assert result == Decimal("10.50")
×
51

52

NEW
53
def test_fields_CommaDecimalField_handles_none_value():
1✔
54
    """Test that field handles None values"""
NEW
55
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
56
    result = field.to_python(None)
×
NEW
57
    assert result is None
×
58

59

NEW
60
def test_fields_CommaDecimalField_handles_empty_string():
1✔
61
    """Test that field handles empty strings"""
NEW
62
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
63
    result = field.to_python("")
×
NEW
64
    assert result is None
×
65

66

NEW
67
def test_fields_CommaDecimalField_raises_validation_error_for_invalid_input():
1✔
68
    """Test that field raises ValidationError for invalid input"""
NEW
69
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
70
    with pytest.raises(ValidationError):
×
NEW
71
        field.to_python("invalid")
×
72

73

NEW
74
def test_fields_CommaDecimalField_raises_validation_error_for_multiple_separators():
1✔
75
    """Test that field raises ValidationError for multiple separators"""
NEW
76
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
77
    with pytest.raises(ValidationError):
×
NEW
78
        field.to_python("10.5,2")
×
79

80

NEW
81
def test_fields_CommaDecimalField_complex_decimal_with_comma():
1✔
82
    """Test complex decimal numbers with comma separator"""
NEW
83
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
84
    result = field.to_python("1234,56")
×
NEW
85
    assert result == Decimal("1234.56")
×
86

87

NEW
88
def test_fields_CommaDecimalField_complex_decimal_with_period():
1✔
89
    """Test complex decimal numbers with period separator"""
NEW
90
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
91
    result = field.to_python("1234.56")
×
NEW
92
    assert result == Decimal("1234.56")
×
93

94

NEW
95
def test_fields_CommaDecimalField_negative_decimal_with_comma():
1✔
96
    """Test negative decimal numbers with comma separator"""
NEW
97
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
98
    result = field.to_python("-10,50")
×
NEW
99
    assert result == Decimal("-10.50")
×
100

101

NEW
102
def test_fields_CommaDecimalField_negative_decimal_with_period():
1✔
103
    """Test negative decimal numbers with period separator"""
NEW
104
    field = CommaDecimalField(max_digits=10, decimal_places=2)
×
NEW
105
    result = field.to_python("-10.50")
×
NEW
106
    assert result == Decimal("-10.50")
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc