| 653 | self.checkJoin(RFC1808_BASE, 'https:;x', 'https:;x') |
| 654 | |
| 655 | def test_urljoins_relative_base(self): |
| 656 | # According to RFC 3986, Section 5.1, a base URI must conform to |
| 657 | # the absolute-URI syntax rule (Section 4.3). But urljoin() lacks |
| 658 | # a context to establish missed components of the relative base URI. |
| 659 | # It still has to return a sensible result for backwards compatibility. |
| 660 | # The following tests are figments of the imagination and artifacts |
| 661 | # of the current implementation that are not based on any standard. |
| 662 | self.checkJoin('', '', '') |
| 663 | self.checkJoin('', '//', '//', relroundtrip=False) |
| 664 | self.checkJoin('', '//v', '//v') |
| 665 | self.checkJoin('', '//v/w', '//v/w') |
| 666 | self.checkJoin('', '/w', '/w') |
| 667 | self.checkJoin('', '///w', '///w', relroundtrip=False) |
| 668 | self.checkJoin('', 'w', 'w') |
| 669 | |
| 670 | self.checkJoin('//', '', '//') |
| 671 | self.checkJoin('//', '//', '//') |
| 672 | self.checkJoin('//', '//v', '//v') |
| 673 | self.checkJoin('//', '//v/w', '//v/w') |
| 674 | self.checkJoin('//', '/w', '///w') |
| 675 | self.checkJoin('//', '///w', '///w') |
| 676 | self.checkJoin('//', 'w', '///w') |
| 677 | |
| 678 | self.checkJoin('//a', '', '//a') |
| 679 | self.checkJoin('//a', '//', '//a') |
| 680 | self.checkJoin('//a', '//v', '//v') |
| 681 | self.checkJoin('//a', '//v/w', '//v/w') |
| 682 | self.checkJoin('//a', '/w', '//a/w') |
| 683 | self.checkJoin('//a', '///w', '//a/w') |
| 684 | self.checkJoin('//a', 'w', '//a/w') |
| 685 | |
| 686 | for scheme in '', 'http:': |
| 687 | self.checkJoin('http:', scheme + '', 'http:') |
| 688 | self.checkJoin('http:', scheme + '//', 'http:') |
| 689 | self.checkJoin('http:', scheme + '//v', 'http://v') |
| 690 | self.checkJoin('http:', scheme + '//v/w', 'http://v/w') |
| 691 | self.checkJoin('http:', scheme + '/w', 'http:/w') |
| 692 | self.checkJoin('http:', scheme + '///w', 'http:/w') |
| 693 | self.checkJoin('http:', scheme + 'w', 'http:/w') |
| 694 | |
| 695 | self.checkJoin('http://', scheme + '', 'http://') |
| 696 | self.checkJoin('http://', scheme + '//', 'http://') |
| 697 | self.checkJoin('http://', scheme + '//v', 'http://v') |
| 698 | self.checkJoin('http://', scheme + '//v/w', 'http://v/w') |
| 699 | self.checkJoin('http://', scheme + '/w', 'http:///w') |
| 700 | self.checkJoin('http://', scheme + '///w', 'http:///w') |
| 701 | self.checkJoin('http://', scheme + 'w', 'http:///w') |
| 702 | |
| 703 | self.checkJoin('http://a', scheme + '', 'http://a') |
| 704 | self.checkJoin('http://a', scheme + '//', 'http://a') |
| 705 | self.checkJoin('http://a', scheme + '//v', 'http://v') |
| 706 | self.checkJoin('http://a', scheme + '//v/w', 'http://v/w') |
| 707 | self.checkJoin('http://a', scheme + '/w', 'http://a/w') |
| 708 | self.checkJoin('http://a', scheme + '///w', 'http://a/w') |
| 709 | self.checkJoin('http://a', scheme + 'w', 'http://a/w') |
| 710 | |
| 711 | self.checkJoin('/b/c', '', '/b/c') |
| 712 | self.checkJoin('/b/c', '//', '/b/c') |