Example #1
0
    def test_work_status_1(self):
        self.composition_work.date_ordered = 1920.0

        pdstatus = pd.determine_status(self.composition_work, self.jurisdiction)
        print pdstatus
        assert self._log_has('publication + 28 + 28', pdstatus.log)
        assert pdstatus.pd_prob == 1.0
Example #2
0
    def test_work_status_5(self):
        self.recording_work.date_ordered = 1985.0

        pdstatus = pd.determine_status(self.recording_work, self.jurisdiction)
        print pdstatus
        assert self._log_has('first publication + 1st Jan + 50', pdstatus.log)
        assert pdstatus.pd_prob == 0.0
Example #3
0
    def test_work_status_2(self):
        self.composer.death_date_ordered = 1950.0

        pdstatus = pd.determine_status(self.composition_work, self.jurisdiction)
        print pdstatus
        assert self._log_has('death + 1st Jan + 70', pdstatus.log)
        assert pdstatus.pd_prob == 0.0
Example #4
0
    def test_work_status_5(self):
        self.artist.death_date_ordered = None
        self.work.date_ordered = 1945.0

        pdstatus = pd.determine_status(self.work, self.jurisdiction)
        print pdstatus.log
        assert self._log_has('Author alive', pdstatus.log)
        assert pdstatus.pd_prob == 0.0
Example #5
0
    def test_work_status_4(self):
        self.artist.death_date_ordered = 1860.0
        self.work.date_ordered = 1845.0

        pdstatus = pd.determine_status(self.work, self.jurisdiction)
        print pdstatus.log
        assert self._log_has('death + 50', pdstatus.log)
        assert pdstatus.pd_prob == 1.0
Example #6
0
    def test_work_status_2(self):
        self.artist.death_date_ordered = 1930.0
        self.work.date_ordered = 1965.0

        pdstatus = pd.determine_status(self.work, self.jurisdiction)
        print pdstatus.log
        assert self._log_has('publication + 50', pdstatus.log)
        assert pdstatus.pd_prob == 0.0
Example #7
0
    def test_work_status_3(self):
        self.composition_work.date_ordered = 1970.0

        pdstatus = pd.determine_status(self.composition_work, self.jurisdiction)
        print pdstatus
        assert self._log_has('publication + 95', pdstatus.log)
        assert not self._log_has('Assuming its copyright was renewed', pdstatus.log)
        assert pdstatus.pd_prob == 0.0
Example #8
0
    def test_work_status_7(self):
        self.composer.birth_date_ordered = 1920.0
        self.composer.death_date_ordered = None

        pdstatus = pd.determine_status(self.composition_work, self.jurisdiction)
        print pdstatus
        assert self._log_has('assuming died 100 years after birth', pdstatus.log)
        assert self._log_has('death + 1st Jan + 70', pdstatus.log)
        assert pdstatus.pd_prob == 0.0
Example #9
0
    def test_work_status_3(self):
        print "NAME", self.composition_work.persons[0].name
        self.composition_work.persons[0].name = 'anonymous'
        self.composition_work.date_ordered = 1930.0

        pdstatus = pd.determine_status(self.composition_work, self.jurisdiction)
        print pdstatus
        assert self._log_has('first publication + 1st Jan + 70', pdstatus.log)
        assert pdstatus.pd_prob == 1.0
Example #10
0
    def test_pd_inthepast(self):
        '''test calculator with date different than today'''
        parsed = json.loads(self.json_data2)
        workdata = parsed['work']
        jurisdiction = parsed['jurisdiction']
        newwork = pd.Work.from_dict(workdata)
        when = '1840' #one year after death of author...
        calc = pd.determine_status(newwork,jurisdiction,when)

        assert calc.pd_prob == 0.0
Example #11
0
    def test_ca(self):
        '''
        test the calculator api for Canada

        '''
        parsed = json.loads(self.json_data1)
        workdata = parsed['work']
        jurisdiction = parsed['jurisdiction']
        newwork = pd.Work.from_dict(workdata)
        calc = pd.determine_status(newwork,jurisdiction)

        assert calc.log>0
Example #12
0
    def test_uk(self):
        '''
        test the calculator api for the UK
        '''
        parsed = json.loads(self.json_data2)
        workdata = parsed['work']
        jurisdiction = parsed['jurisdiction']
        newwork = pd.Work.from_dict(workdata)
        calc = pd.determine_status(newwork,jurisdiction)

        print parsed  
        return calc
        assert calc.log>0
Example #13
0
 def creating_by_hand(self):
     newperson = pd.Person(name='Borges, Jorge Luis',
                            death_date='1986',
                            type='person')
     newwork = pd.Work(title='El Aleph',
                        date='1949',
                        creation_date='1919',
                        type='text')
     newwork.persons = [ newperson]
     self.person = newperson
     self.work = newwork
     calc = pd.determine_status(newwork,'ca')
     return calc
     assert 'confidence' in calc.log