Skip to content

Commit

Permalink
497 (#504)
Browse files Browse the repository at this point in the history
* Added labels

* Tracing

* Investigating the bug

* Added approximation_grain

* Clean up debugger

* Added test cases

* Added assert in some test cases

* Able to print an empty triangle

* Added test cases

* Fixed display issues

* Update base.py

* Addressed a calculation bug

* Added debugger

* Modified test

* Removed debugger

* Remove attemps to address 491

* Better tests

---------

Co-authored-by: John S Bogaardt <[email protected]>
  • Loading branch information
kennethshsu and jbogaardt authored Apr 4, 2024
1 parent 88a2f1c commit 583760a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
10 changes: 5 additions & 5 deletions chainladder/core/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

class TriangleDisplay:
def __repr__(self):
try:
self.values
except:
print("Triangle is empty")
return
# try:
# self.values
# except:
# print("Triangle is empty")
# return

if (self.values.shape[0], self.values.shape[1]) == (1, 1):
data = self._repr_format()
Expand Down
26 changes: 17 additions & 9 deletions chainladder/core/tests/test_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,25 @@

def test_heatmap_render(raa):
"""The heatmap method should render correctly given the sample."""
assert raa.heatmap()
try:
raa.heatmap()

except:
assert False

def test_empty_triangle():
assert cl.Triangle()

# def test_empty_triangle():
# assert cl.Triangle()


def test_to_frame(raa):
assert cl.Chainladder().fit(raa).cdf_.to_frame()
assert cl.Chainladder().fit(raa).cdf_.to_frame(origin_as_datetime=False)
assert cl.Chainladder().fit(raa).cdf_.to_frame(origin_as_datetime=True)
assert cl.Chainladder().fit(raa).ultimate_.to_frame()
assert cl.Chainladder().fit(raa).ultimate_.to_frame(origin_as_datetime=False)
assert cl.Chainladder().fit(raa).ultimate_.to_frame(origin_as_datetime=True)
try:
cl.Chainladder().fit(raa).cdf_.to_frame()
cl.Chainladder().fit(raa).cdf_.to_frame(origin_as_datetime=False)
cl.Chainladder().fit(raa).cdf_.to_frame(origin_as_datetime=True)
cl.Chainladder().fit(raa).ultimate_.to_frame()
cl.Chainladder().fit(raa).ultimate_.to_frame(origin_as_datetime=False)
cl.Chainladder().fit(raa).ultimate_.to_frame(origin_as_datetime=True)

except:
assert False

0 comments on commit 583760a

Please sign in to comment.