示例#1
0
 def test_number_of_conflicts_when_2_conflicts(self):
     diplomat = Diplomat([
         Claim(123, 2, 2, 0, 0),
         Claim(456, 2, 2, 1, 1),
         Claim(456, 1, 1, 0, 1),
     ])
     assert diplomat.number_of_conflicts() == 2
示例#2
0
        def test_parse_should_return_a_claim_with_more_that_digit(self):
            claim = Claim.parse('#1 @ 56,249: 24x16')

            assert claim.rectangle.width == 24
            assert claim.rectangle.height == 16
            assert claim.rectangle.inches_from_left_side == 56
            assert claim.rectangle.inches_from_top_side == 249
示例#3
0
        def test_parse_should_return_a_claim_the_dimensions(self):
            claim = Claim.parse('#123 @ 3,2: 5x4')

            assert claim.rectangle.width == 5
            assert claim.rectangle.height == 4
            assert claim.rectangle.inches_from_left_side == 3
            assert claim.rectangle.inches_from_top_side == 2
示例#4
0
 def test_parse_should_return_a_claim_with_an_id(self):
     claim = Claim.parse('#123 @ 3,2: 5x4')
     assert claim.id == 123
示例#5
0
 def test_parse_should_return_a_claim(self):
     claim = Claim.parse('#123 @ 3,2: 5x4')
     assert isinstance(claim, Claim)
示例#6
0
        def test_when_no_conflict_should_return_false(self):
            claim_one = Claim.parse('#123 @ 0,0: 1x1')
            claim_false = Claim.parse('#123 @ 2,2: 1x1')

            assert claim_one.is_in_conflict_with(claim_false) == False
示例#7
0
from Day3.Claim import Claim
from Day3.Diplomat import Diplomat
from utils.FileReader import FileReader

list_of_claims_scheme = FileReader.read('../sources/day3.txt')

list_of_claims = [Claim.parse(claim) for claim in list_of_claims_scheme]

diplomate = Diplomat(list_of_claims)
print(diplomate.number_of_conflicts())