import pytest
from skylines.model import Bounds, Location


class TestBounds():
    def test_constructor(self):
        # Check that only Location instances are accepted
        with pytest.raises(ValueError): Bounds(3, 5)

        sw = Location(latitude=49, longitude=6)
        ne = Location(latitude=51, longitude=7)
        b = Bounds(sw, ne)

        assert b.southwest.latitude == 49
        assert b.southwest.longitude == 6
        assert b.northeast.latitude == 51
        assert b.northeast.longitude == 7

    def test_from_bbox_string(self):
        # Check that strings with more or less than 4 components
        # raise ValueError
        with pytest.raises(ValueError): Bounds.from_bbox_string('1,2,3')
        Bounds.from_bbox_string('1,2,3,4')
        with pytest.raises(ValueError): Bounds.from_bbox_string('1,2,3,4,5')

        # Check that non-numeric values raise ValueError
        with pytest.raises(ValueError): Bounds.from_bbox_string('1,a,3,4')

        # Check that BBox strings are parsed correctly
        b = Bounds.from_bbox_string('6.05,49.5,7,51.0')

        assert b.southwest.latitude == 49.5
        assert b.southwest.longitude == 6.05
        assert b.northeast.latitude == 51
        assert b.northeast.longitude == 7

    def test_get_sizes(self):
        # Check normal size calculations
        b = Bounds.from_bbox_string('1,50,21,52')

        assert b.get_width() == 20
        assert b.get_height() == 2
        assert b.get_size() == 40

        # Check longitude wraparound and height == 0
        b = Bounds.from_bbox_string('170,50,-165,50')

        assert b.get_width() == 25
        assert b.get_height() == 0
        assert b.get_size() == 0

@@ -57,32 +57,8 @@
 n%0A%0A%0A
-class TestBounds():%0A    
 def 
@@ -74,27 +74,19 @@
 tructor(
-self):%0A    
+):%0A
     # Ch
@@ -131,28 +131,24 @@
 ccepted%0A    
- 
-   
 with pytest.
@@ -185,20 +185,16 @@
 5)%0A%0A    
-   
- 
 sw = Loc
@@ -225,20 +225,16 @@
 tude=6)%0A
-    
     ne =
@@ -269,20 +269,16 @@
 tude=7)%0A
-    
     b = 
@@ -293,20 +293,16 @@
 w, ne)%0A%0A
-    
     asse
@@ -331,28 +331,24 @@
 e == 49%0A    
-   
- 
 assert b.sou
@@ -369,28 +369,24 @@
 de == 6%0A    
-  
-  
 assert b.nor
@@ -403,36 +403,32 @@
 itude == 51%0A    
- 
-   
 assert b.northea
@@ -438,36 +438,33 @@
 longitude == 7%0A%0A
-    
+%0A
 def test_from_bb
@@ -473,27 +473,19 @@
 _string(
-self):%0A    
+):%0A
     # Ch
@@ -537,20 +537,16 @@
 ponents%0A
-    
     # ra
@@ -552,36 +552,32 @@
 aise ValueError%0A
-    
     with pytest.
@@ -633,20 +633,16 @@
 3')%0A    
-  
-  
 Bounds.f
@@ -668,20 +668,16 @@
 2,3,4')%0A
-    
     with
@@ -738,28 +738,24 @@
 ,2,3,4,5')%0A%0A
-    
     # Check 
@@ -799,20 +799,16 @@
 ror%0A    
- 
-   
 with pyt
@@ -863,28 +863,24 @@
 '1,a,3,4')%0A%0A
-    
     # Check 
@@ -918,20 +918,16 @@
 rrectly%0A
-    
     b = 
@@ -967,28 +967,24 @@
 5,7,51.0')%0A%0A
-    
     assert b
@@ -1011,28 +1011,24 @@
 == 49.5%0A    
-  
-  
 assert b.sou
@@ -1052,28 +1052,24 @@
 == 6.05%0A    
-   
- 
 assert b.nor
@@ -1090,20 +1090,16 @@
 e == 51%0A
-    
     asse
@@ -1129,20 +1129,17 @@
 e == 7%0A%0A
+%0A
-    
 def test
@@ -1153,19 +1153,11 @@
 zes(
-self):%0A    
+):%0A
     
@@ -1189,20 +1189,16 @@
 lations%0A
-    
     b = 
@@ -1232,28 +1232,24 @@
 50,21,52')%0A%0A
-    
     assert b
@@ -1267,28 +1267,24 @@
 ) == 20%0A    
-  
-  
 assert b.get
@@ -1298,28 +1298,24 @@
 () == 2%0A    
-   
- 
 assert b.get
@@ -1329,20 +1329,16 @@
  == 40%0A%0A
-    
     # Ch
@@ -1382,20 +1382,16 @@
 = 0%0A    
- 
-   
 b = Boun
@@ -1429,28 +1429,24 @@
 5,50')%0A%0A    
-  
-  
 assert b.get
@@ -1460,28 +1460,24 @@
 ) == 25%0A    
-   
- 
 assert b.get
@@ -1491,20 +1491,16 @@
 () == 0%0A
-    
     asse

Use simple methods instead of class