File tree Expand file tree Collapse file tree 4 files changed +38
-15
lines changed
Expand file tree Collapse file tree 4 files changed +38
-15
lines changed Original file line number Diff line number Diff line change 1111
1212 steps :
1313 - name : Checkout code
14- uses : actions/checkout@v2
14+ uses : actions/checkout@v3
1515 with :
1616 submodules : " recursive"
1717
2020 run : echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
2121
2222 - name : Set up Python 3.9
23- uses : actions/setup-python@v2
23+ uses : actions/setup-python@v4
2424 with :
2525 python-version : " 3.9"
2626
Original file line number Diff line number Diff line change 4848
4949 - name : Install Poetry
5050 shell : bash
51- run : curl -fsSL https://install.python-poetry.org | python - -y
51+ run : curl -fsSL https://install.python-poetry.org | python - -y --version 1.4.0
5252
5353 - name : Update PATH
5454 if : ${{ matrix.os != 'Windows' }}
Original file line number Diff line number Diff line change @@ -579,6 +579,29 @@ def test_item_array_of_dicts_converted_to_aot():
579579 )
580580
581581
582+ def test_add_float_to_int ():
583+ content = "[table]\n my_int = 2043"
584+ doc = parse (content )
585+ doc ["table" ]["my_int" ] += 5.0
586+ assert doc ["table" ]["my_int" ] == 2048.0
587+ assert isinstance (doc ["table" ]["my_int" ], float )
588+
589+
590+ def test_sub_float_from_int ():
591+ content = "[table]\n my_int = 2048"
592+ doc = parse (content )
593+ doc ["table" ]["my_int" ] -= 5.0
594+ assert doc ["table" ]["my_int" ] == 2043.0
595+ assert isinstance (doc ["table" ]["my_int" ], float )
596+
597+
598+ def test_sub_int_from_float ():
599+ content = "[table]\n my_int = 2048.0"
600+ doc = parse (content )
601+ doc ["table" ]["my_int" ] -= 5
602+ assert doc ["table" ]["my_int" ] == 2043.0
603+
604+
582605def test_add_sum_int_with_float ():
583606 content = "[table]\n my_int = 2048.3"
584607 doc = parse (content )
Original file line number Diff line number Diff line change @@ -647,28 +647,28 @@ def as_string(self) -> str:
647647 return self ._raw
648648
649649 def __add__ (self , other ):
650- return self ._new (int (self ._raw ) + other )
650+ result = super ().__add__ (other )
651+ if result is NotImplemented :
652+ return result
653+ return self ._new (result )
651654
652655 def __radd__ (self , other ):
653656 result = super ().__radd__ (other )
654-
655- if isinstance (other , Integer ):
656- return self ._new (result )
657-
658- return result
657+ if result is NotImplemented :
658+ return result
659+ return self ._new (result )
659660
660661 def __sub__ (self , other ):
661662 result = super ().__sub__ (other )
662-
663+ if result is NotImplemented :
664+ return result
663665 return self ._new (result )
664666
665667 def __rsub__ (self , other ):
666668 result = super ().__rsub__ (other )
667-
668- if isinstance (other , Integer ):
669- return self ._new (result )
670-
671- return result
669+ if result is NotImplemented :
670+ return result
671+ return self ._new (result )
672672
673673 def _new (self , result ):
674674 raw = str (result )
You can’t perform that action at this time.
0 commit comments