Example #1
0
    def test_buildfromunit(self):
        unit = self.UnitClass("test source")
        unit_copy = self.UnitClass.buildfromunit(unit)
        assert unit is not unit_copy
        assert unit == unit_copy

        # Test with a unit without copy() method (will call base.buildfromunit)
        from translate.storage.php import phpunit
        unit = phpunit("test source")
        unit_copy = self.UnitClass.buildfromunit(unit)
        assert unit is not unit_copy
        assert unit == unit_copy
Example #2
0
    def test_buildfromunit(self):
        unit = self.UnitClass("test source")
        unit_copy = self.UnitClass.buildfromunit(unit)
        assert unit is not unit_copy
        assert unit == unit_copy

        # Test with a unit without copy() method (will call base.buildfromunit)
        from translate.storage.php import phpunit
        unit = phpunit("test source")
        unit_copy = self.UnitClass.buildfromunit(unit)
        assert unit is not unit_copy
        assert unit == unit_copy
Example #3
0
    def test_buildfromunit(self):
        unit = self.UnitClass("test source")
        unit_copy = self.UnitClass.buildfromunit(unit)
        assert unit is not unit_copy
        assert unit == unit_copy

        # Test with a unit without copy() method (will call base.buildfromunit)
        unit = phpunit("$test_source")
        unit_copy = self.UnitClass.buildfromunit(unit)
        unit.setid(unit_copy.getid())
        assert unit.getid() == unit_copy.getid()
        assert unit is not unit_copy
        assert unit == unit_copy