Example #1
0
def test_grs():
    assert Dec().grs == "0   "
    assert Dec(123).grs == "123   "
    assert Dec(-123).grs == "-123   "
    assert Dec(123.50).grs == "123,5 "
    assert Dec(123.51).grs == "123,51"
    assert Dec(123456.789).grs == "123.456,79"
    assert Dec(-1234567.89).grs == "-1.234.567,89"
Example #2
0
 def __init__(self, date: str, parastatiko: str, perigrafi: str, afm=""):
     self.__class__.cid += 1
     self.id = self.cid
     self.date = date
     self.parastatiko = parastatiko
     self.perigrafi = perigrafi
     self.afm = afm
     self.delta = Dec(0)
     self.lines = []
     self.fpa_status = 0  # 0: Χωρίς ΦΠΑ, 1: ΦΠΑ οκ, 2: ΦΠΑ λάθος
Example #3
0
def test_sum_decs():
    assert Dec(1.35) + Dec("1.2") == 2.55
Example #4
0
def test_complex():
    assert (Dec(1.5) + 1) * 2 == 5
Example #5
0
def test_dec_round_01():
    assert Dec("-123.4554") == -123.46
Example #6
0
def test_mul():
    assert Dec(100.25) * 4 == 401
    assert 100.25 * Dec(4) == 401
    assert Dec(40) * 1.5 == 60
    assert 40 * Dec(1.5) == Dec(60)
Example #7
0
def test_neg():
    assert -Dec(40) == -40
    assert -Dec(-40) == 40
Example #8
0
def test_dec_of_0():
    assert Dec(0) == 0
Example #9
0
def test_dec_of_None():
    assert Dec(None) == 0
Example #10
0
def test_dec_of_float():
    assert Dec(123.45) == 123.45
Example #11
0
def test_sum_dec_int():
    assert Dec(134.54) + 100 == Dec("234.54")
Example #12
0
def test_from_gr():
    assert Dec.from_gr("1.234,565") == 1234.57
    assert Dec.from_gr(",565") == 0.57
    assert Dec.from_gr(",565g") == 0
Example #13
0
def test_gr():
    assert Dec().gr == ""
    assert Dec(123456.78).gr == "123.456,78"
    assert Dec(123456.0).gr == "123.456,00"
    assert Dec(123456.7).gr == "123.456,70"
    assert Dec(-123456.7).gr == "-123.456,70"
Example #14
0
def test_repr():
    assert repr(Dec(123)) == "Dec(123.00)"
    assert repr(Dec(0)) == "Dec(0.00)"
    assert repr(Dec("just-text")) == "Dec(0.00)"
Example #15
0
def test_ge():
    assert Dec(1) >= 0
    assert 1 >= Dec(0)
    assert Dec(0) >= 0
    assert 1 >= Dec(1)
Example #16
0
def test_gt():
    assert Dec(1) > 0
    assert 1 > Dec(0)
Example #17
0
def test_sum_decs_negative_01():
    assert Dec(1.35) + Dec("-1.2") == 0.15
Example #18
0
def test_sum_dec_float():
    assert Dec(134.54) + 100.02 == Dec("234.56")
Example #19
0
def test_sum_decs_negative_02():
    assert Dec(-1.35) + Dec("-1.2") == -2.55
Example #20
0
def test_eq():
    assert Dec("test") == 0
    assert Dec("123.245") == 123.25
    assert Dec("123.245") == Dec(123.25)
    assert Dec(-123.245) == -123.25
Example #21
0
def test_sum_int_dec():
    assert 1000.41 + Dec(134.54) == Dec("1134.95")
Example #22
0
def test_general():
    vl1 = Dec(10.23)
    vl2 = Dec(16.77)
    assert vl1 + vl2 == 27
Example #23
0
def test_sum_foat_dec():
    assert 144 + Dec(134.54) == Dec("278.54")
Example #24
0
def test_dec_of_negative_float():
    assert Dec(-123.45) == -123.45
Example #25
0
def test_dec_sub():
    assert Dec(1.35) - Dec(1) == 0.35
    assert Dec(1.35) - 1 == 0.35
    assert 1.35 - Dec(1) == 0.35
Example #26
0
def test_dec_of_str_num():
    assert Dec("123.45") == 123.45
Example #27
0
def test_truediv():
    assert Dec(40) / 2 == 20
    assert 40 / Dec(2) == 20
    assert 40.0 / Dec(2) == 20
Example #28
0
def test_dec_of_negative_str_num():
    assert Dec("-123.45") == -123.45
Example #29
0
def test_abs():
    assert abs(Dec(40)) == 40
    assert abs(Dec(-40)) == 40
    assert abs(Dec(-0)) == 0
Example #30
0
def test_dec_of_string():
    assert Dec("aaasf") == 0