diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..28c7c531
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,304 @@
+GNU LESSER GENERAL PUBLIC LICENSE
+Version 3, 29 June 2007
+
+Copyright (C) 2007 Free Software Foundation, Inc.
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
+
+0. Additional Definitions.
+
+As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License.
+
+"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
+
+An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
+
+A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version".
+
+The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
+
+The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
+
+1. Exception to Section 3 of the GNU GPL.
+You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
+
+2. Conveying Modified Versions.
+If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
+
+ a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
+
+3. Object Code Incorporating Material from Library Header Files.
+The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license document.
+
+4. Combined Works.
+You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
+
+ a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
+
+ c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
+
+ e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
+
+5. Combined Libraries.
+You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
+
+6. Revised Versions of the GNU Lesser General Public License.
+The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
+
+If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
+
+GNU GENERAL PUBLIC LICENSE
+Version 3, 29 June 2007
+
+Copyright © 2007 Free Software Foundation, Inc.
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+Preamble
+
+The GNU General Public License is a free, copyleft license for software and other kinds of works.
+
+The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
+
+To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
+
+For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
+
+Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
+
+Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
+
+The precise terms and conditions for copying, distribution and modification follow.
+
+TERMS AND CONDITIONS
+
+0. Definitions.
+
+“This License” refers to version 3 of the GNU General Public License.
+
+“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
+
+“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
+
+To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
+
+A “covered work” means either the unmodified Program or a work based on the Program.
+
+To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
+
+To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
+
+An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
+
+1. Source Code.
+The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
+
+A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
+
+The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
+
+The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
+
+The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
+
+The Corresponding Source for a work in source code form is that same work.
+
+2. Basic Permissions.
+All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
+
+You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
+
+Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
+
+3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
+
+When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
+
+4. Conveying Verbatim Copies.
+You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
+
+You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
+
+5. Conveying Modified Source Versions.
+You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
+
+ c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
+
+A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
+
+6. Conveying Non-Source Forms.
+You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
+
+ d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
+
+A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
+
+A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
+
+“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
+
+If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
+
+The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
+
+Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
+
+7. Additional Terms.
+“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
+
+When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
+
+Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
+
+All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
+
+If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
+
+Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
+
+8. Termination.
+You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
+
+However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
+
+Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
+
+9. Acceptance Not Required for Having Copies.
+You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
+
+10. Automatic Licensing of Downstream Recipients.
+Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
+
+An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
+
+You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
+
+11. Patents.
+A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
+
+A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
+
+Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
+
+In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
+
+If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
+
+If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
+
+A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
+
+Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
+
+12. No Surrender of Others' Freedom.
+If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
+
+13. Use with the GNU Affero General Public License.
+Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
+
+14. Revised Versions of this License.
+The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
+
+If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
+
+Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
+
+15. Disclaimer of Warranty.
+THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+16. Limitation of Liability.
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+17. Interpretation of Sections 15 and 16.
+If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
+
+
+ Copyright (C) 2026
+
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
+
+ Copyright (C) 2026
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
+
+You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see .
+
+The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read .
diff --git a/cssutils.egg-info/PKG-INFO b/cssutils.egg-info/PKG-INFO
new file mode 100644
index 00000000..29ab01f5
--- /dev/null
+++ b/cssutils.egg-info/PKG-INFO
@@ -0,0 +1,187 @@
+Metadata-Version: 2.4
+Name: cssutils
+Version: 2.15.1.dev9+g8ebbbcfb5
+Summary: A CSS Cascading Style Sheets library for Python
+Author-email: Christof Hoeke
+Maintainer-email: "Jason R. Coombs"
+License-Expression: LGPL-3.0-or-later
+Project-URL: Source, https://github.com/jaraco/cssutils
+Keywords: CSS,Cascading Style Sheets,CSSParser,DOM Level 2 Stylesheets,DOM Level 2 CSS
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Topic :: Internet
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Text Processing :: Markup :: HTML
+Requires-Python: >=3.10
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: more_itertools
+Requires-Dist: encutils
+Provides-Extra: test
+Requires-Dist: pytest!=8.1.*,>=6; extra == "test"
+Requires-Dist: lxml; python_version < "3.11" and extra == "test"
+Requires-Dist: cssselect; extra == "test"
+Requires-Dist: importlib_resources; python_version < "3.9" and extra == "test"
+Requires-Dist: jaraco.test>=5.1; extra == "test"
+Provides-Extra: doc
+Requires-Dist: sphinx>=3.5; extra == "doc"
+Requires-Dist: jaraco.packaging>=9.3; extra == "doc"
+Requires-Dist: rst.linker>=1.9; extra == "doc"
+Requires-Dist: furo; extra == "doc"
+Requires-Dist: sphinx-lint; extra == "doc"
+Requires-Dist: jaraco.tidelift>=1.4; extra == "doc"
+Provides-Extra: check
+Requires-Dist: pytest-checkdocs>=2.14; extra == "check"
+Requires-Dist: pytest-ruff>=0.2.1; sys_platform != "cygwin" and extra == "check"
+Provides-Extra: cover
+Requires-Dist: pytest-cov; extra == "cover"
+Provides-Extra: enabler
+Requires-Dist: pytest-enabler>=3.4; extra == "enabler"
+Provides-Extra: type
+Requires-Dist: pytest-mypy>=1.0.1; platform_python_implementation != "PyPy" and extra == "type"
+Dynamic: license-file
+
+.. image:: https://img.shields.io/pypi/v/cssutils.svg
+ :target: https://pypi.org/project/cssutils
+
+.. image:: https://img.shields.io/pypi/pyversions/cssutils.svg
+
+.. image:: https://github.com/jaraco/cssutils/actions/workflows/main.yml/badge.svg
+ :target: https://github.com/jaraco/cssutils/actions?query=workflow%3A%22tests%22
+ :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
+ :target: https://github.com/astral-sh/ruff
+ :alt: Ruff
+
+.. image:: https://readthedocs.org/projects/cssutils/badge/?version=latest
+ :target: https://cssutils.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2026-informational
+ :target: https://blog.jaraco.com/skeleton
+
+.. image:: https://tidelift.com/badges/package/pypi/cssutils
+ :target: https://tidelift.com/subscription/pkg/pypi-cssutils?utm_source=pypi-cssutils&utm_medium=readme
+
+
+Overview
+========
+A Python package to parse and build CSS Cascading Style Sheets. DOM only, not any rendering facilities!
+
+You can find more documentation at `cssutils.readthedocs.io `_.
+
+Based upon and partly implementing the following specifications :
+
+`CSS 2.1rev1 `__
+ General CSS rules and properties are defined here
+`CSS3 Module: Syntax `__
+ Used in parts since cssutils 0.9.4. cssutils tries to use the features from CSS 2.1 and CSS 3 with preference to CSS3 but as this is not final yet some parts are from CSS 2.1
+`CSS Fonts Module Level 3 `__
+ Added changes and additional stuff (since cssutils v0.9.6)
+`MediaQueries `__
+ MediaQueries are part of ``stylesheets.MediaList`` since v0.9.4, used in @import and @media rules.
+`Namespaces `__
+ Added in v0.9.1, updated to definition in CSSOM in v0.9.4, updated in 0.9.5 for dev version
+`CSS3 Module: Pages Media `__
+ Most properties of this spec are implemented including MarginRules
+`Selectors `__
+ The selector syntax defined here (and not in CSS 2.1) should be parsable with cssutils (*should* mind though ;) )
+`CSS Backgrounds and Borders Module Level 3 `__, `CSS3 Basic User Interface Module `__, `CSS Text Level 3 `__
+ Some validation for properties included, mainly `cursor`, `outline`, `resize`, `box-shadow`, `text-shadow`
+`Variables `__ / `CSS Custom Properties `__
+ Experimental specification of CSS Variables which cssutils implements partly. The vars defined in the newer CSS Custom Properties spec should in main parts be at least parsable with cssutils.
+
+`DOM Level 2 Style CSS `__
+ DOM for package css. 0.9.8 removes support for CSSValue and related API, see PropertyValue and Value API for now
+`DOM Level 2 Style Stylesheets `__
+ DOM for package stylesheets
+`CSSOM `__
+ A few details (mainly the NamespaceRule DOM) are taken from here. Plan is to move implementation to the stuff defined here which is newer but still no REC so might change anytime...
+
+The cssutils tokenizer is a customized implementation of `CSS3 Module: Syntax (W3C Working Draft 13 August 2003) `_ which itself is based on the CSS 2.1 tokenizer. It tries to be as compliant as possible but uses some (helpful) parts of the CSS 2.1 tokenizer.
+
+I guess cssutils is neither CSS 2.1 nor CSS 3 compliant but tries to at least be able to parse both grammars including some more real world cases (some CSS hacks are actually parsed and serialized). Both official grammars are not final nor bugfree but still feasible. cssutils aim is not to be fully compliant to any CSS specification (the specifications seem to be in a constant flow anyway) but cssutils *should* be able to read and write as many as possible CSS stylesheets "in the wild" while at the same time implement the official APIs which are well documented. Some minor extensions are provided as well.
+
+
+Compatibility
+=============
+
+cssutils is developed on modern Python versions. Check the package metadata
+for compatibilty.
+
+Beware, cssutils is known to be thread unsafe.
+
+
+Example
+=======
+::
+
+ import cssutils
+
+ css = '''/* a comment with umlaut ä */
+ @namespace html "http://www.w3.org/1999/xhtml";
+ @variables { BG: #fff }
+ html|a { color:red; background: var(BG) }'''
+ sheet = cssutils.parseString(css)
+
+ for rule in sheet:
+ if rule.type == rule.STYLE_RULE:
+ # find property
+ for property in rule.style:
+ if property.name == 'color':
+ property.value = 'green'
+ property.priority = 'IMPORTANT'
+ break
+ # or simply:
+ rule.style['margin'] = '01.0eM' # or: ('1em', 'important')
+
+ sheet.encoding = 'ascii'
+ sheet.namespaces['xhtml'] = 'http://www.w3.org/1999/xhtml'
+ sheet.namespaces['atom'] = 'http://www.w3.org/2005/Atom'
+ sheet.add('atom|title {color: #000000 !important}')
+ sheet.add('@import "sheets/import.css";')
+
+ # cssutils.ser.prefs.resolveVariables == True since 0.9.7b2
+ print sheet.cssText
+
+results in::
+
+ @charset "ascii";
+ @import "sheets/import.css";
+ /* a comment with umlaut \E4 */
+ @namespace xhtml "http://www.w3.org/1999/xhtml";
+ @namespace atom "http://www.w3.org/2005/Atom";
+ xhtml|a {
+ color: green !important;
+ background: #fff;
+ margin: 1em
+ }
+ atom|title {
+ color: #000 !important
+ }
+
+
+Kind Request
+============
+
+cssutils is far from being perfect or even complete. If you find any bugs (especially specification violations) or have problems or suggestions please put them in the `Issue Tracker `_.
+
+
+Thanks
+======
+
+Special thanks to Christof Höke for seminal creation of the library.
+
+Thanks to Simon Sapin, Jason R. Coombs, and Walter Doerwald for patches, help and discussion. Thanks to Kevin D. Smith for the value validating module. Thanks also to Cory Dodt, Tim Gerla, James Dobson and Amit Moscovich for helpful suggestions and code patches. Thanks to Fredrik Hedman for help on port of encutils to Python 3.
+
+
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more `_.
diff --git a/cssutils.egg-info/SOURCES.txt b/cssutils.egg-info/SOURCES.txt
new file mode 100644
index 00000000..0677e5d2
--- /dev/null
+++ b/cssutils.egg-info/SOURCES.txt
@@ -0,0 +1,322 @@
+.coveragerc
+.editorconfig
+.pre-commit-config.yaml
+.readthedocs.yaml
+AGENTS.md
+LICENSE
+NEWS.rst
+README.rst
+SECURITY.md
+conftest.py
+mypy.ini
+pyproject.toml
+pytest.ini
+ruff.toml
+towncrier.toml
+tox.ini
+.github/FUNDING.yml
+.github/workflows/main.yml
+cssutils/__init__.py
+cssutils/_fetch.py
+cssutils/_fetchgae.py
+cssutils/codec.py
+cssutils/css2productions.py
+cssutils/cssproductions.py
+cssutils/errorhandler.py
+cssutils/helper.py
+cssutils/parse.py
+cssutils/prodparser.py
+cssutils/profiles.py
+cssutils/sac.py
+cssutils/script.py
+cssutils/serialize.py
+cssutils/settings.py
+cssutils/tokenize2.py
+cssutils/util.py
+cssutils.egg-info/PKG-INFO
+cssutils.egg-info/SOURCES.txt
+cssutils.egg-info/dependency_links.txt
+cssutils.egg-info/entry_points.txt
+cssutils.egg-info/requires.txt
+cssutils.egg-info/top_level.txt
+cssutils/css/__init__.py
+cssutils/css/colors.py
+cssutils/css/csscharsetrule.py
+cssutils/css/csscomment.py
+cssutils/css/cssfontfacerule.py
+cssutils/css/cssimportrule.py
+cssutils/css/cssmediarule.py
+cssutils/css/cssnamespacerule.py
+cssutils/css/csspagerule.py
+cssutils/css/cssproperties.py
+cssutils/css/cssrule.py
+cssutils/css/cssrulelist.py
+cssutils/css/cssstyledeclaration.py
+cssutils/css/cssstylerule.py
+cssutils/css/cssstylesheet.py
+cssutils/css/cssunknownrule.py
+cssutils/css/cssvalue.py
+cssutils/css/cssvariablesdeclaration.py
+cssutils/css/cssvariablesrule.py
+cssutils/css/marginrule.py
+cssutils/css/property.py
+cssutils/css/selector.py
+cssutils/css/selectorlist.py
+cssutils/css/value.py
+cssutils/scripts/__init__.py
+cssutils/scripts/csscapture.py
+cssutils/scripts/csscombine.py
+cssutils/scripts/cssparse.py
+cssutils/stylesheets/__init__.py
+cssutils/stylesheets/medialist.py
+cssutils/stylesheets/mediaquery.py
+cssutils/stylesheets/stylesheet.py
+cssutils/stylesheets/stylesheetlist.py
+docs/backlog.rst
+docs/codec.rst
+docs/conf.py
+docs/css.rst
+docs/encutils.rst
+docs/history.rst
+docs/index.rst
+docs/known issues.rst
+docs/logging.rst
+docs/migrate.rst
+docs/parse.rst
+docs/profiles.rst
+docs/scripts.rst
+docs/serialize.rst
+docs/settings.rst
+docs/stylesheets.rst
+docs/utilities.rst
+docs/variables.rst
+docs/html/.buildinfo
+docs/html/CHANGELOG.html
+docs/html/README.html
+docs/html/_2to3 py3.html
+docs/html/genindex.html
+docs/html/index.html
+docs/html/py-modindex.html
+docs/html/search.html
+docs/html/searchindex.js
+docs/html/_sources/CHANGELOG.txt
+docs/html/_sources/README.txt
+docs/html/_sources/index.txt
+docs/html/_sources/docs/backlog.txt
+docs/html/_sources/docs/codec.txt
+docs/html/_sources/docs/css.txt
+docs/html/_sources/docs/cssstyledeclaration.txt
+docs/html/_sources/docs/cssutils.txt
+docs/html/_sources/docs/encutils.txt
+docs/html/_sources/docs/implementation.txt
+docs/html/_sources/docs/logging.txt
+docs/html/_sources/docs/migrate.txt
+docs/html/_sources/docs/parse.txt
+docs/html/_sources/docs/profiles.txt
+docs/html/_sources/docs/scripts.txt
+docs/html/_sources/docs/serialize.txt
+docs/html/_sources/docs/settings.txt
+docs/html/_sources/docs/stylesheets.txt
+docs/html/_sources/docs/utilities.txt
+docs/html/_sources/docs/variables.txt
+docs/html/_static/basic.css
+docs/html/_static/default.css
+docs/html/_static/doctools.js
+docs/html/_static/file.png
+docs/html/_static/jquery.js
+docs/html/_static/minus.png
+docs/html/_static/plus.png
+docs/html/_static/pygments.css
+docs/html/_static/searchtools.js
+docs/html/_static/sidebar.js
+docs/html/_static/underscore.js
+docs/html/docs/backlog.html
+docs/html/docs/codec.html
+docs/html/docs/css.html
+docs/html/docs/encutils.html
+docs/html/docs/logging.html
+docs/html/docs/migrate.html
+docs/html/docs/parse.html
+docs/html/docs/profiles.html
+docs/html/docs/scripts.html
+docs/html/docs/serialize.html
+docs/html/docs/settings.html
+docs/html/docs/stylesheets.html
+docs/html/docs/utilities.html
+docs/html/docs/variables.html
+examples/__init__.py
+examples/build.py
+examples/codec.py
+examples/cssencodings.py
+examples/customlog.py
+examples/imports.py
+examples/minify.py
+examples/parse.py
+examples/properties_with_same_name.py
+examples/selectors_tolower.py
+examples/serialize.py
+examples/style.py
+examples/styledeclaration.py
+examples/testutil.py
+examples/website.py
+examples/sheets/096.css
+examples/sheets/097.css
+examples/sheets/1.css
+examples/sheets/1ascii.css
+examples/sheets/1import.css
+examples/sheets/1inherit-ascii.css
+examples/sheets/1inherit-iso.css
+examples/sheets/1inherit-utf8.css
+examples/sheets/1utf.css
+examples/sheets/2inherit-iso.css
+examples/sheets/2resolve.css
+examples/sheets/acid2.css
+examples/sheets/all.css
+examples/sheets/atrule.css
+examples/sheets/bad.css
+examples/sheets/basic.css
+examples/sheets/bundle.css
+examples/sheets/cases.css
+examples/sheets/csscombine-1.css
+examples/sheets/csscombine-2.css
+examples/sheets/csscombine-proxy.css
+examples/sheets/cthedot_default.css
+examples/sheets/default_html4.css
+examples/sheets/hacks.css
+examples/sheets/html.css
+examples/sheets/html20.css
+examples/sheets/html40.css
+examples/sheets/import.css
+examples/sheets/import3.css
+examples/sheets/ll.css
+examples/sheets/ll2.css
+examples/sheets/multiple-values.css
+examples/sheets/page_test.css
+examples/sheets/sample_5.css
+examples/sheets/sample_7.css
+examples/sheets/simple.css
+examples/sheets/single-color.css
+examples/sheets/slashcode.css
+examples/sheets/t-HACKS.css
+examples/sheets/test-unicode.css
+examples/sheets/test.css
+examples/sheets/tigris.css
+examples/sheets/tigris2.css
+examples/sheets/u_simple.css
+examples/sheets/v_simple.css
+examples/sheets/vars.css
+examples/sheets/varsimport.css
+examples/sheets/xhtml2.css
+examples/sheets/xhtml22.css
+examples/sheets/yuck.css
+examples/sheets/images/example.gif
+examples/sheets/import/import-impossible.css
+examples/sheets/import/import2.css
+examples/sheets/import/images2/example2.gif
+examples/sheets/var/start.css
+examples/sheets/var/use.css
+examples/sheets/var/vars.css
+examples/sheets/var/vars2.css
+tests/__init__.py
+tests/basetest.py
+tests/test_codec.py
+tests/test_csscharsetrule.py
+tests/test_csscomment.py
+tests/test_cssfontfacerule.py
+tests/test_cssimportrule.py
+tests/test_cssmediarule.py
+tests/test_cssnamespacerule.py
+tests/test_csspagerule.py
+tests/test_cssproperties.py
+tests/test_cssrule.py
+tests/test_cssrulelist.py
+tests/test_cssstyledeclaration.py
+tests/test_cssstylerule.py
+tests/test_cssstylesheet.py
+tests/test_cssunknownrule.py
+tests/test_cssutils.py
+tests/test_cssutilsimport.py
+tests/test_cssvalue.py
+tests/test_cssvariablesdeclaration.py
+tests/test_cssvariablesrule.py
+tests/test_domimplementation.py
+tests/test_errorhandler.py
+tests/test_helper.py
+tests/test_marginrule.py
+tests/test_medialist.py
+tests/test_mediaquery.py
+tests/test_parse.py
+tests/test_prodparser.py
+tests/test_profiles.py
+tests/test_properties.py
+tests/test_property.py
+tests/test_scripts_csscombine.py
+tests/test_selector.py
+tests/test_selectorlist.py
+tests/test_serialize.py
+tests/test_settings.py
+tests/test_stylesheet.py
+tests/test_tokenize2.py
+tests/test_util.py
+tests/test_value.py
+tests/test_x.py
+tests/sheets/096.css
+tests/sheets/097.css
+tests/sheets/1.css
+tests/sheets/1ascii.css
+tests/sheets/1import.css
+tests/sheets/1inherit-ascii.css
+tests/sheets/1inherit-iso.css
+tests/sheets/1inherit-utf8.css
+tests/sheets/1utf.css
+tests/sheets/2inherit-iso.css
+tests/sheets/2resolve.css
+tests/sheets/acid2.css
+tests/sheets/all.css
+tests/sheets/atrule.css
+tests/sheets/bad.css
+tests/sheets/basic.css
+tests/sheets/bundle.css
+tests/sheets/cases.css
+tests/sheets/csscombine-1.css
+tests/sheets/csscombine-2.css
+tests/sheets/csscombine-proxy.css
+tests/sheets/cthedot_default.css
+tests/sheets/default_html4.css
+tests/sheets/hacks.css
+tests/sheets/html.css
+tests/sheets/html20.css
+tests/sheets/html40.css
+tests/sheets/import.css
+tests/sheets/import3.css
+tests/sheets/ll.css
+tests/sheets/ll2.css
+tests/sheets/multiple-values.css
+tests/sheets/page_test.css
+tests/sheets/sample_5.css
+tests/sheets/sample_7.css
+tests/sheets/simple.css
+tests/sheets/single-color.css
+tests/sheets/slashcode.css
+tests/sheets/t-HACKS.css
+tests/sheets/test-unicode.css
+tests/sheets/test.css
+tests/sheets/tigris.css
+tests/sheets/tigris2.css
+tests/sheets/u_simple.css
+tests/sheets/v_simple.css
+tests/sheets/vars.css
+tests/sheets/varsimport.css
+tests/sheets/xhtml2.css
+tests/sheets/xhtml22.css
+tests/sheets/yuck.css
+tests/sheets/images/example.gif
+tests/sheets/import/import-impossible.css
+tests/sheets/import/import2.css
+tests/sheets/import/images2/example2.gif
+tests/sheets/var/start.css
+tests/sheets/var/use.css
+tests/sheets/var/vars.css
+tests/sheets/var/vars2.css
+tools/speed.py
+tools/try.py
\ No newline at end of file
diff --git a/cssutils.egg-info/dependency_links.txt b/cssutils.egg-info/dependency_links.txt
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/cssutils.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/cssutils.egg-info/entry_points.txt b/cssutils.egg-info/entry_points.txt
new file mode 100644
index 00000000..9bb6c972
--- /dev/null
+++ b/cssutils.egg-info/entry_points.txt
@@ -0,0 +1,4 @@
+[console_scripts]
+csscapture = cssutils.scripts.csscapture:main
+csscombine = cssutils.scripts.csscombine:main
+cssparse = cssutils.scripts.cssparse:main
diff --git a/cssutils.egg-info/requires.txt b/cssutils.egg-info/requires.txt
new file mode 100644
index 00000000..595189b3
--- /dev/null
+++ b/cssutils.egg-info/requires.txt
@@ -0,0 +1,38 @@
+more_itertools
+encutils
+
+[check]
+pytest-checkdocs>=2.14
+
+[check:sys_platform != "cygwin"]
+pytest-ruff>=0.2.1
+
+[cover]
+pytest-cov
+
+[doc]
+sphinx>=3.5
+jaraco.packaging>=9.3
+rst.linker>=1.9
+furo
+sphinx-lint
+jaraco.tidelift>=1.4
+
+[enabler]
+pytest-enabler>=3.4
+
+[test]
+pytest!=8.1.*,>=6
+cssselect
+jaraco.test>=5.1
+
+[test:python_version < "3.11"]
+lxml
+
+[test:python_version < "3.9"]
+importlib_resources
+
+[type]
+
+[type:platform_python_implementation != "PyPy"]
+pytest-mypy>=1.0.1
diff --git a/cssutils.egg-info/top_level.txt b/cssutils.egg-info/top_level.txt
new file mode 100644
index 00000000..4957bc13
--- /dev/null
+++ b/cssutils.egg-info/top_level.txt
@@ -0,0 +1 @@
+cssutils
diff --git a/cssutils/__init__.py b/cssutils/__init__.py
index 38d22353..a30b5c6d 100644
--- a/cssutils/__init__.py
+++ b/cssutils/__init__.py
@@ -61,8 +61,7 @@
>>> parser = CSSParser()
>>> sheet = parser.parseString('a { color: red}')
- # TODO: shouldn't have to decode here
- >>> print(sheet.cssText.decode())
+ >>> print(sheet.cssText)
a {
color: red
}
diff --git a/cssutils/__pycache__/__init__.cpython-312.pyc b/cssutils/__pycache__/__init__.cpython-312.pyc
new file mode 100644
index 00000000..ab92ae7a
Binary files /dev/null and b/cssutils/__pycache__/__init__.cpython-312.pyc differ
diff --git a/cssutils/__pycache__/_fetch.cpython-312.pyc b/cssutils/__pycache__/_fetch.cpython-312.pyc
new file mode 100644
index 00000000..d8a4b830
Binary files /dev/null and b/cssutils/__pycache__/_fetch.cpython-312.pyc differ
diff --git a/cssutils/__pycache__/_fetchgae.cpython-312.pyc b/cssutils/__pycache__/_fetchgae.cpython-312.pyc
new file mode 100644
index 00000000..ef0f5014
Binary files /dev/null and b/cssutils/__pycache__/_fetchgae.cpython-312.pyc differ
diff --git a/cssutils/__pycache__/codec.cpython-312.pyc b/cssutils/__pycache__/codec.cpython-312.pyc
new file mode 100644
index 00000000..b1c2dc66
Binary files /dev/null and b/cssutils/__pycache__/codec.cpython-312.pyc differ
diff --git a/cssutils/__pycache__/cssproductions.cpython-312.pyc b/cssutils/__pycache__/cssproductions.cpython-312.pyc
new file mode 100644
index 00000000..9a145c89
Binary files /dev/null and b/cssutils/__pycache__/cssproductions.cpython-312.pyc differ
diff --git a/cssutils/__pycache__/errorhandler.cpython-312.pyc b/cssutils/__pycache__/errorhandler.cpython-312.pyc
new file mode 100644
index 00000000..87a07110
Binary files /dev/null and b/cssutils/__pycache__/errorhandler.cpython-312.pyc differ
diff --git a/cssutils/__pycache__/helper.cpython-312.pyc b/cssutils/__pycache__/helper.cpython-312.pyc
new file mode 100644
index 00000000..21d14b51
Binary files /dev/null and b/cssutils/__pycache__/helper.cpython-312.pyc differ
diff --git a/cssutils/__pycache__/parse.cpython-312.pyc b/cssutils/__pycache__/parse.cpython-312.pyc
new file mode 100644
index 00000000..b29822b7
Binary files /dev/null and b/cssutils/__pycache__/parse.cpython-312.pyc differ
diff --git a/cssutils/__pycache__/prodparser.cpython-312.pyc b/cssutils/__pycache__/prodparser.cpython-312.pyc
new file mode 100644
index 00000000..0b66386d
Binary files /dev/null and b/cssutils/__pycache__/prodparser.cpython-312.pyc differ
diff --git a/cssutils/__pycache__/profiles.cpython-312.pyc b/cssutils/__pycache__/profiles.cpython-312.pyc
new file mode 100644
index 00000000..4677c300
Binary files /dev/null and b/cssutils/__pycache__/profiles.cpython-312.pyc differ
diff --git a/cssutils/__pycache__/serialize.cpython-312.pyc b/cssutils/__pycache__/serialize.cpython-312.pyc
new file mode 100644
index 00000000..a0eaaa0b
Binary files /dev/null and b/cssutils/__pycache__/serialize.cpython-312.pyc differ
diff --git a/cssutils/__pycache__/tokenize2.cpython-312.pyc b/cssutils/__pycache__/tokenize2.cpython-312.pyc
new file mode 100644
index 00000000..a48e8eef
Binary files /dev/null and b/cssutils/__pycache__/tokenize2.cpython-312.pyc differ
diff --git a/cssutils/__pycache__/util.cpython-312.pyc b/cssutils/__pycache__/util.cpython-312.pyc
new file mode 100644
index 00000000..aa1e26d8
Binary files /dev/null and b/cssutils/__pycache__/util.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/__init__.cpython-312.pyc b/cssutils/css/__pycache__/__init__.cpython-312.pyc
new file mode 100644
index 00000000..b65f5a24
Binary files /dev/null and b/cssutils/css/__pycache__/__init__.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/colors.cpython-312.pyc b/cssutils/css/__pycache__/colors.cpython-312.pyc
new file mode 100644
index 00000000..357feffb
Binary files /dev/null and b/cssutils/css/__pycache__/colors.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/csscharsetrule.cpython-312.pyc b/cssutils/css/__pycache__/csscharsetrule.cpython-312.pyc
new file mode 100644
index 00000000..17207627
Binary files /dev/null and b/cssutils/css/__pycache__/csscharsetrule.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/csscomment.cpython-312.pyc b/cssutils/css/__pycache__/csscomment.cpython-312.pyc
new file mode 100644
index 00000000..411ff176
Binary files /dev/null and b/cssutils/css/__pycache__/csscomment.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/cssfontfacerule.cpython-312.pyc b/cssutils/css/__pycache__/cssfontfacerule.cpython-312.pyc
new file mode 100644
index 00000000..f3c020af
Binary files /dev/null and b/cssutils/css/__pycache__/cssfontfacerule.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/cssimportrule.cpython-312.pyc b/cssutils/css/__pycache__/cssimportrule.cpython-312.pyc
new file mode 100644
index 00000000..cab4cb32
Binary files /dev/null and b/cssutils/css/__pycache__/cssimportrule.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/cssmediarule.cpython-312.pyc b/cssutils/css/__pycache__/cssmediarule.cpython-312.pyc
new file mode 100644
index 00000000..f59b3c26
Binary files /dev/null and b/cssutils/css/__pycache__/cssmediarule.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/cssnamespacerule.cpython-312.pyc b/cssutils/css/__pycache__/cssnamespacerule.cpython-312.pyc
new file mode 100644
index 00000000..140df533
Binary files /dev/null and b/cssutils/css/__pycache__/cssnamespacerule.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/csspagerule.cpython-312.pyc b/cssutils/css/__pycache__/csspagerule.cpython-312.pyc
new file mode 100644
index 00000000..90d910b3
Binary files /dev/null and b/cssutils/css/__pycache__/csspagerule.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/cssproperties.cpython-312.pyc b/cssutils/css/__pycache__/cssproperties.cpython-312.pyc
new file mode 100644
index 00000000..52539fdc
Binary files /dev/null and b/cssutils/css/__pycache__/cssproperties.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/cssrule.cpython-312.pyc b/cssutils/css/__pycache__/cssrule.cpython-312.pyc
new file mode 100644
index 00000000..9045bb98
Binary files /dev/null and b/cssutils/css/__pycache__/cssrule.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/cssrulelist.cpython-312.pyc b/cssutils/css/__pycache__/cssrulelist.cpython-312.pyc
new file mode 100644
index 00000000..baf2e28e
Binary files /dev/null and b/cssutils/css/__pycache__/cssrulelist.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/cssstyledeclaration.cpython-312.pyc b/cssutils/css/__pycache__/cssstyledeclaration.cpython-312.pyc
new file mode 100644
index 00000000..6185629a
Binary files /dev/null and b/cssutils/css/__pycache__/cssstyledeclaration.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/cssstylerule.cpython-312.pyc b/cssutils/css/__pycache__/cssstylerule.cpython-312.pyc
new file mode 100644
index 00000000..434fe569
Binary files /dev/null and b/cssutils/css/__pycache__/cssstylerule.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/cssstylesheet.cpython-312.pyc b/cssutils/css/__pycache__/cssstylesheet.cpython-312.pyc
new file mode 100644
index 00000000..3f55ae44
Binary files /dev/null and b/cssutils/css/__pycache__/cssstylesheet.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/cssunknownrule.cpython-312.pyc b/cssutils/css/__pycache__/cssunknownrule.cpython-312.pyc
new file mode 100644
index 00000000..8af97264
Binary files /dev/null and b/cssutils/css/__pycache__/cssunknownrule.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/cssvariablesdeclaration.cpython-312.pyc b/cssutils/css/__pycache__/cssvariablesdeclaration.cpython-312.pyc
new file mode 100644
index 00000000..9a62d837
Binary files /dev/null and b/cssutils/css/__pycache__/cssvariablesdeclaration.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/cssvariablesrule.cpython-312.pyc b/cssutils/css/__pycache__/cssvariablesrule.cpython-312.pyc
new file mode 100644
index 00000000..0afee074
Binary files /dev/null and b/cssutils/css/__pycache__/cssvariablesrule.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/marginrule.cpython-312.pyc b/cssutils/css/__pycache__/marginrule.cpython-312.pyc
new file mode 100644
index 00000000..667b9c70
Binary files /dev/null and b/cssutils/css/__pycache__/marginrule.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/property.cpython-312.pyc b/cssutils/css/__pycache__/property.cpython-312.pyc
new file mode 100644
index 00000000..0eddf4b0
Binary files /dev/null and b/cssutils/css/__pycache__/property.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/selector.cpython-312.pyc b/cssutils/css/__pycache__/selector.cpython-312.pyc
new file mode 100644
index 00000000..7fb1b8b9
Binary files /dev/null and b/cssutils/css/__pycache__/selector.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/selectorlist.cpython-312.pyc b/cssutils/css/__pycache__/selectorlist.cpython-312.pyc
new file mode 100644
index 00000000..6d619efc
Binary files /dev/null and b/cssutils/css/__pycache__/selectorlist.cpython-312.pyc differ
diff --git a/cssutils/css/__pycache__/value.cpython-312.pyc b/cssutils/css/__pycache__/value.cpython-312.pyc
new file mode 100644
index 00000000..5766b14b
Binary files /dev/null and b/cssutils/css/__pycache__/value.cpython-312.pyc differ
diff --git a/cssutils/css/cssstylesheet.py b/cssutils/css/cssstylesheet.py
index ee434ca4..ea14c973 100644
--- a/cssutils/css/cssstylesheet.py
+++ b/cssutils/css/cssstylesheet.py
@@ -146,7 +146,7 @@ def cssRules(self, cssRules):
self._cssRules = cssRules
def _getCssText(self):
- "Textual representation of the stylesheet (a byte string)."
+ "Textual representation of the stylesheet."
return cssutils.ser.do_CSSStyleSheet(self)
def _setCssText(self, cssText): # noqa: C901
@@ -361,7 +361,7 @@ def ruleset(expected, seq, token, tokenizer):
cssText = property(
_getCssText,
_setCssText,
- "Textual representation of the stylesheet (a byte string)",
+ "Textual representation of the stylesheet",
)
def _resolveImport(self, url):
diff --git a/cssutils/script.py b/cssutils/script.py
index 9fdb1c12..ecb6630f 100644
--- a/cssutils/script.py
+++ b/cssutils/script.py
@@ -310,7 +310,7 @@ def saveto(self, dir, saveraw=False, minified=False):
uf = codecs.getwriter('css')(sf)
uf.write(cssText)
else:
- sf.write(sheet.cssText)
+ sf.write(sheet.cssText.encode(sheet.encoding))
sf.close()
diff --git a/cssutils/serialize.py b/cssutils/serialize.py
index b9765184..35530c6b 100644
--- a/cssutils/serialize.py
+++ b/cssutils/serialize.py
@@ -408,8 +408,7 @@ def do_CSSStyleSheet(self, stylesheet):
except (IndexError, AttributeError):
encoding = 'UTF-8'
- # TODO: py3 return b str but tests use unicode?
- return text.encode(encoding, 'escapecss')
+ return text.encode(encoding, 'escapecss').decode(encoding)
def do_CSSComment(self, rule):
"""
diff --git a/cssutils/stylesheets/__pycache__/__init__.cpython-312.pyc b/cssutils/stylesheets/__pycache__/__init__.cpython-312.pyc
new file mode 100644
index 00000000..4d0cc52b
Binary files /dev/null and b/cssutils/stylesheets/__pycache__/__init__.cpython-312.pyc differ
diff --git a/cssutils/stylesheets/__pycache__/medialist.cpython-312.pyc b/cssutils/stylesheets/__pycache__/medialist.cpython-312.pyc
new file mode 100644
index 00000000..0bb2d025
Binary files /dev/null and b/cssutils/stylesheets/__pycache__/medialist.cpython-312.pyc differ
diff --git a/cssutils/stylesheets/__pycache__/mediaquery.cpython-312.pyc b/cssutils/stylesheets/__pycache__/mediaquery.cpython-312.pyc
new file mode 100644
index 00000000..f3ee9fc4
Binary files /dev/null and b/cssutils/stylesheets/__pycache__/mediaquery.cpython-312.pyc differ
diff --git a/cssutils/stylesheets/__pycache__/stylesheet.cpython-312.pyc b/cssutils/stylesheets/__pycache__/stylesheet.cpython-312.pyc
new file mode 100644
index 00000000..dea2b85b
Binary files /dev/null and b/cssutils/stylesheets/__pycache__/stylesheet.cpython-312.pyc differ
diff --git a/cssutils/stylesheets/__pycache__/stylesheetlist.cpython-312.pyc b/cssutils/stylesheets/__pycache__/stylesheetlist.cpython-312.pyc
new file mode 100644
index 00000000..97f252e0
Binary files /dev/null and b/cssutils/stylesheets/__pycache__/stylesheetlist.cpython-312.pyc differ
diff --git a/examples/website.py b/examples/website.py
index dc773275..5ee8a0a6 100644
--- a/examples/website.py
+++ b/examples/website.py
@@ -38,7 +38,7 @@ def cssparse_example():
>>> cssutils.log.setLevel(logging.FATAL)
>>> sheet = cssutils.parseString('@import url(example.css); body { color: red }')
>>> # log output not shown
- >>> print(sheet.cssText.decode())
+ >>> print(sheet.cssText)
@import url(example.css);
body {
color: red
@@ -77,7 +77,7 @@ def prefs():
>>> cssutils.ser.prefs.importHrefFormat = 'uri'
>>> # or 'string', defaults to the format used in parsed stylesheet
>>> cssutils.ser.prefs.lineNumbers = True
- >>> print(sheet.cssText.decode())
+ >>> print(sheet.cssText)
1: @import url(example.css);
2: body {
3: color: red
@@ -93,7 +93,7 @@ def work_and_build():
>>> from cssutils import css, stylesheets
>>> sheet = css.CSSStyleSheet()
>>> sheet.cssText = '@import url(example.css) tv;'
- >>> print(sheet.cssText.decode())
+ >>> print(sheet.cssText)
@import url(example.css) tv;
>>> style = css.CSSStyleDeclaration()
>>> style['color'] = 'red' # until 0.9.5: setProperty(u'color', u'red')
@@ -104,7 +104,7 @@ def work_and_build():
>>> # sheet.insertRule(stylerule, 0) # try before @import
>>> # xml.dom.HierarchyRequestErr: CSSStylesheet: Found @charset, @import or @namespace before index 0.
>>> # sheet.insertRule(stylerule) # at end of rules, returns index
- >>> print(sheet.cssText.decode())
+ >>> print(sheet.cssText)
@import url(example.css) tv;
body {
color: red
@@ -115,7 +115,7 @@ def work_and_build():
>>> # returns the new Selector:
>>> sheet.cssRules[1].selectorList.appendSelector('a')
cssutils.css.Selector(selectorText='a')
- >>> print(sheet.cssText.decode())
+ >>> print(sheet.cssText)
@import url(example.css) tv, print;
body, a {
color: red
diff --git a/tests/basetest.py b/tests/basetest.py
index a8d5569c..eba25cfc 100644
--- a/tests/basetest.py
+++ b/tests/basetest.py
@@ -26,7 +26,7 @@ def do_equal_p(tests, att='cssText', raising=True):
s = p.parseString(test)
if expected is None:
expected = test
- assert str(s.__getattribute__(att), 'utf-8') == expected
+ assert s.__getattribute__(att) == expected
@staticmethod
def do_raise_p(tests, raising=True):
diff --git a/tests/test_cssimportrule.py b/tests/test_cssimportrule.py
index b5b99c92..f6dcf5c1 100644
--- a/tests/test_cssimportrule.py
+++ b/tests/test_cssimportrule.py
@@ -211,12 +211,12 @@ def fetcher(url):
sheet = parser.parseString('@import "http://example.com/yes" "name"')
r = sheet.cssRules[0]
- assert b'/**/' == r.styleSheet.cssText
+ assert '/**/' == r.styleSheet.cssText
assert r.hrefFound
assert 'name' == r.name
r.cssText = '@import url(http://example.com/none) "name2";'
- assert b'' == r.styleSheet.cssText
+ assert '' == r.styleSheet.cssText
assert not r.hrefFound
assert 'name2' == r.name
@@ -349,7 +349,7 @@ def fetcher(url):
assert ir.styleSheet.title == 'title'
assert (
ir.styleSheet.cssText
- == b'@charset "ascii";\n@import "level2/css.css" "title2";'
+ == '@charset "ascii";\n@import "level2/css.css" "title2";'
)
ir2 = ir.styleSheet.cssRules[1]
@@ -361,9 +361,7 @@ def fetcher(url):
assert ir2.styleSheet.media.mediaText == 'all'
assert ir2.styleSheet.parentStyleSheet is None # ir.styleSheet
assert ir2.styleSheet.title == 'title2'
- assert (
- ir2.styleSheet.cssText == b'@charset "ascii";\na {\n color: red\n }'
- )
+ assert ir2.styleSheet.cssText == '@charset "ascii";\na {\n color: red\n }'
sheet = cssutils.parseString('@import "CANNOT-FIND.css";')
ir = sheet.cssRules[0]
@@ -372,9 +370,9 @@ def fetcher(url):
def fetcher(url):
if url.endswith('level1.css'):
- return None, b'@charset "ascii"; @import "level2.css";'
+ return None, '@charset "ascii"; @import "level2.css";'
else:
- return None, b'a { color: red }'
+ return None, 'a { color: red }'
parser = cssutils.CSSParser(fetcher=fetcher)
diff --git a/tests/test_cssstylesheet.py b/tests/test_cssstylesheet.py
index 0f33992f..eaa95971 100644
--- a/tests/test_cssstylesheet.py
+++ b/tests/test_cssstylesheet.py
@@ -117,7 +117,7 @@ def test_cssRules(self):
assert 2 == s.cssRules.length
s.cssRules.extend(cssutils.parseString('/*3*/x {y:2}').cssRules)
assert 4 == s.cssRules.length
- assert b'a {\n x: 1\n }\n/*2*/\n/*3*/\nx {\n y: 2\n }' == s.cssText
+ assert 'a {\n x: 1\n }\n/*2*/\n/*3*/\nx {\n y: 2\n }' == s.cssText
for r in s.cssRules:
assert r.parentStyleSheet == s
@@ -125,30 +125,30 @@ def test_cssRules(self):
def test_cssText(self):
"CSSStyleSheet.cssText"
tests = {
- '': b'',
+ '': '',
# @charset
- '@charset "ascii";\n@import "x";': b'@charset "ascii";\n@import "x";',
- '@charset "ascii";\n@media all {}': b'@charset "ascii";',
- '@charset "ascii";\n@x;': b'@charset "ascii";\n@x;',
- '@charset "ascii";\na {\n x: 1\n }': b'@charset "ascii";\na {\n x: 1\n }',
+ '@charset "ascii";\n@import "x";': '@charset "ascii";\n@import "x";',
+ '@charset "ascii";\n@media all {}': '@charset "ascii";',
+ '@charset "ascii";\n@x;': '@charset "ascii";\n@x;',
+ '@charset "ascii";\na {\n x: 1\n }': '@charset "ascii";\na {\n x: 1\n }',
# @import
- '@x;\n@import "x";': b'@x;\n@import "x";',
- '@import "x";\n@import "y";': b'@import "x";\n@import "y";',
- '@import "x";\n@media all {}': b'@import "x";',
- '@import "x";\n@x;': b'@import "x";\n@x;',
- '@import "x";\na {\n x: 1\n }': b'@import "x";\na {\n x: 1\n }',
+ '@x;\n@import "x";': '@x;\n@import "x";',
+ '@import "x";\n@import "y";': '@import "x";\n@import "y";',
+ '@import "x";\n@media all {}': '@import "x";',
+ '@import "x";\n@x;': '@import "x";\n@x;',
+ '@import "x";\na {\n x: 1\n }': '@import "x";\na {\n x: 1\n }',
# @namespace
- '@x;\n@namespace a "x";': b'@x;\n@namespace a "x";',
- '@namespace a "x";\n@namespace b "y";': b'@namespace a "x";\n@namespace b "y";',
- '@import "x";\n@namespace a "x";\n@media all {}': b'@import "x";\n@namespace a "x";',
- '@namespace a "x";\n@x;': b'@namespace a "x";\n@x;',
- '@namespace a "x";\na {\n x: 1\n }': b'@namespace a "x";\na {\n x: 1\n }',
+ '@x;\n@namespace a "x";': '@x;\n@namespace a "x";',
+ '@namespace a "x";\n@namespace b "y";': '@namespace a "x";\n@namespace b "y";',
+ '@import "x";\n@namespace a "x";\n@media all {}': '@import "x";\n@namespace a "x";',
+ '@namespace a "x";\n@x;': '@namespace a "x";\n@x;',
+ '@namespace a "x";\na {\n x: 1\n }': '@namespace a "x";\na {\n x: 1\n }',
"""@namespace url("e1");
@namespace url("e2");
@namespace x url("x1");
@namespace x url("x2");
test{color: green}
- x|test {color: green}""": b"""@namespace "e2";
+ x|test {color: green}""": """@namespace "e2";
@namespace x "x2";
test {
color: green
@@ -312,7 +312,7 @@ def test_namespaces1(self):
top: 0
}'''
s.cssText = css
- assert s.cssText == expcss.encode()
+ assert s.cssText == expcss
assert s.namespaces.namespaces == {'': 'default', 'ex2': 'example'}
# __contains__
@@ -361,7 +361,7 @@ def test_namespaces2(self):
css = '@namespace n "new";'
# doubles will be removed
s.insertRule(css + css)
- assert s.cssText == css.encode()
+ assert s.cssText == css
r = cssutils.css.CSSNamespaceRule(prefix='ex2', namespaceURI='example')
s.insertRule(r)
r = cssutils.css.CSSNamespaceRule(namespaceURI='default')
@@ -370,12 +370,12 @@ def test_namespaces2(self):
expcss = '''@namespace n "new";
@namespace ex2 "example";
@namespace "default";'''
- assert s.cssText == expcss.encode()
+ assert s.cssText == expcss
r.prefix = 'DEFAULT'
expcss = '''@namespace n "new";
@namespace ex2 "example";
@namespace DEFAULT "default";'''
- assert s.cssText == expcss.encode()
+ assert s.cssText == expcss
# CSSMediaRule
with pytest.raises(xml.dom.NamespaceErr):
@@ -383,7 +383,7 @@ def test_namespaces2(self):
mcss = '@media all {\n ex2|SEL1 {\n left: 0\n }\n }'
s.add(mcss)
expcss += '\n' + mcss
- assert s.cssText == expcss.encode()
+ assert s.cssText == expcss
# CSSStyleRule
with pytest.raises(xml.dom.NamespaceErr):
@@ -391,7 +391,7 @@ def test_namespaces2(self):
scss = 'n|SEL2 {\n top: 0\n }'
s.add(scss)
expcss += '\n' + scss
- assert s.cssText == expcss.encode()
+ assert s.cssText == expcss
mr = s.cssRules[3]
sr = s.cssRules[4]
@@ -402,14 +402,14 @@ def test_namespaces2(self):
oldsel, newsel = mr.cssRules[0].selectorText, 'n|SEL3, a'
mr.cssRules[0].selectorText = newsel
expcss = expcss.replace(oldsel, newsel)
- assert s.cssText == expcss.encode()
+ assert s.cssText == expcss
# SelectorList stylerule
with pytest.raises(xml.dom.NamespaceErr):
sr._setSelectorText('x|b')
oldsel, newsel = sr.selectorText, 'ex2|SEL4, a'
sr.selectorText = newsel
expcss = expcss.replace(oldsel, newsel)
- assert s.cssText == expcss.encode()
+ assert s.cssText == expcss
# Selector @media
with pytest.raises(xml.dom.NamespaceErr):
@@ -417,18 +417,18 @@ def test_namespaces2(self):
oldsel, newsel = mr.cssRules[0].selectorText, 'ex2|SELMR'
mr.cssRules[0].selectorList.append(newsel)
expcss = expcss.replace(oldsel, oldsel + ', ' + newsel)
- assert s.cssText == expcss.encode()
+ assert s.cssText == expcss
# Selector stylerule
with pytest.raises(xml.dom.NamespaceErr):
sr.selectorList.append('x|b')
oldsel, newsel = sr.selectorText, 'ex2|SELSR'
sr.selectorList.append(newsel)
expcss = expcss.replace(oldsel, oldsel + ', ' + newsel)
- assert s.cssText == expcss.encode()
+ assert s.cssText == expcss
assert (
s.cssText
- == b'''@namespace n "new";
+ == '''@namespace n "new";
@namespace ex2 "example";
@namespace DEFAULT "default";
@media all {
@@ -455,7 +455,7 @@ def test_namespaces3(self):
r = cssutils.css.CSSStyleRule()
r.cssText = (css, {'h': 'html'})
s.add(r) # uses x as set before! h is temporary only
- assert s.cssText == b'@namespace x "html";\nx|a {\n top: 0\n }'
+ assert s.cssText == '@namespace x "html";\nx|a {\n top: 0\n }'
# prefix is now "x"!
with pytest.raises(xml.dom.NamespaceErr):
@@ -464,19 +464,19 @@ def test_namespaces3(self):
r.selectorList.append('y|b')
s.namespaces['y'] = 'html'
r.selectorList.append('y|b')
- assert s.cssText == b'@namespace y "html";\ny|a, y|b {\n top: 0\n }'
+ assert s.cssText == '@namespace y "html";\ny|a, y|b {\n top: 0\n }'
with pytest.raises(xml.dom.NoModificationAllowedErr):
s.namespaces.__delitem__('y')
- assert s.cssText == b'@namespace y "html";\ny|a, y|b {\n top: 0\n }'
+ assert s.cssText == '@namespace y "html";\ny|a, y|b {\n top: 0\n }'
s.cssRules[0].prefix = ''
- assert s.cssText == b'@namespace "html";\na, b {\n top: 0\n }'
+ assert s.cssText == '@namespace "html";\na, b {\n top: 0\n }'
# remove need of namespace
s.cssRules[0].prefix = 'x'
s.cssRules[1].selectorText = 'a, b'
- assert s.cssText == b'@namespace x "html";\na, b {\n top: 0\n }'
+ assert s.cssText == '@namespace x "html";\na, b {\n top: 0\n }'
def test_namespaces4(self):
"CSSStyleSheet.namespaces 4"
@@ -511,7 +511,7 @@ def test_namespaces5(self):
"CSSStyleSheet.namespaces 5"
# unknown namespace
s = cssutils.parseString('a|a { color: red }')
- assert s.cssText == b''
+ assert s.cssText == ''
s = cssutils.css.CSSStyleSheet()
with pytest.raises(xml.dom.NamespaceErr, match=r"Prefix a not found\."):
@@ -534,21 +534,21 @@ def test_deleteRuleIndex(self):
assert 4 == self.s.cssRules.length
assert (
- b'@charset "ascii";\n@import "x";\n@x;\na {\n x: 1\n }'
+ '@charset "ascii";\n@import "x";\n@x;\na {\n x: 1\n }'
== self.s.cssText
)
# beginning
self.s.deleteRule(0)
assert 3 == self.s.cssRules.length
- assert b'@import "x";\n@x;\na {\n x: 1\n }' == self.s.cssText
+ assert '@import "x";\n@x;\na {\n x: 1\n }' == self.s.cssText
# middle
self.s.deleteRule(1)
assert 2 == self.s.cssRules.length
- assert b'@import "x";\na {\n x: 1\n }' == self.s.cssText
+ assert '@import "x";\na {\n x: 1\n }' == self.s.cssText
# end
self.s.deleteRule(1)
assert 1 == self.s.cssRules.length
- assert b'@import "x";' == self.s.cssText
+ assert '@import "x";' == self.s.cssText
def test_deleteRule(self):
"CSSStyleSheet.deleteRule(rule)"
@@ -570,13 +570,13 @@ def test_deleteRule(self):
assert 3 == s.cssRules.length
assert (
s.cssText
- == b'a {\n color: red\n }\nb {\n color: blue\n }\nc {\n color: green\n }'
+ == 'a {\n color: red\n }\nb {\n color: blue\n }\nc {\n color: green\n }'
)
with pytest.raises(xml.dom.IndexSizeErr):
s.deleteRule(n)
s.deleteRule(s2)
assert 2 == s.cssRules.length
- assert s.cssText == b'a {\n color: red\n }\nc {\n color: green\n }'
+ assert s.cssText == 'a {\n color: red\n }\nc {\n color: green\n }'
with pytest.raises(xml.dom.IndexSizeErr):
s.deleteRule(s2)
@@ -604,7 +604,7 @@ def _gets(self):
s.insertRule(self.pr) # 6
s.insertRule(self.sr) # 7
assert (
- b'@charset "ascii";\n@import url(x);\n@namespace p "uri";\n@media all {\n @m;\n }\na {\n x: 1\n }\n@media all {\n @m;\n }\n@page {\n margin: 0\n }\na {\n x: 1\n }'
+ '@charset "ascii";\n@import url(x);\n@namespace p "uri";\n@media all {\n @m;\n }\na {\n x: 1\n }\n@media all {\n @m;\n }\n@page {\n margin: 0\n }\na {\n x: 1\n }'
== s.cssText
)
return s, s.cssRules.length
@@ -627,7 +627,7 @@ def test_add(self):
fullcss = '\n'.join(css)
full.cssText = fullcss
- assert full.cssText == fullcss.encode()
+ assert full.cssText == fullcss
for i, line in enumerate(css):
# sheet without same ruletype
before = css[:i]
@@ -637,14 +637,14 @@ def test_add(self):
index = sheet.add(line)
if i < 3:
# specific insertion point
- assert fullcss.encode() == sheet.cssText
+ assert fullcss == sheet.cssText
assert i == index
else:
# end of sheet
expected = before
expected.extend(after)
expected.append(line)
- assert '\n'.join(expected).encode() == sheet.cssText
+ assert '\n'.join(expected) == sheet.cssText
assert len(expected) - 1 == index # no same rule present
# sheet with the same ruletype
@@ -656,7 +656,7 @@ def test_add(self):
full.cssText = fullcss
index = full.add(line)
if i < 1:
- assert fullcss.encode() == sheet.cssText
+ assert fullcss == sheet.cssText
assert i == index # no same rule present
else:
if i < 3:
@@ -671,7 +671,7 @@ def test_add(self):
expected.append(line)
expectedindex = len(expected) - 1
- assert '\n'.join(expected).encode() == full.cssText
+ assert '\n'.join(expected) == full.cssText
assert expectedindex == index # no same rule present
def test_addimport(self):
@@ -690,7 +690,7 @@ def test_addimport(self):
assert sheet == added.parentStyleSheet
assert 'example.css' == added.href
assert 'utf-8' == added.styleSheet.encoding
- assert b'/**/' == added.styleSheet.cssText
+ assert '/**/' == added.styleSheet.cssText
cssrulessheet = p.parseString('@import "example.css";')
imports = (
@@ -707,9 +707,9 @@ def test_addimport(self):
assert 'example.css' == added.href
assert enc == added.styleSheet.encoding
if enc == 'ascii':
- assert b'@charset "ascii";\n/**/' == added.styleSheet.cssText
+ assert '@charset "ascii";\n/**/' == added.styleSheet.cssText
else:
- assert b'/**/' == added.styleSheet.cssText
+ assert '/**/' == added.styleSheet.cssText
# if styleSheet is already there encoding is not set new
impsheet = p.parseString('@import "example.css";')
@@ -720,7 +720,7 @@ def test_addimport(self):
assert sheet == added.parentStyleSheet
assert 'example.css' == added.href
assert 'utf-8' == added.styleSheet.encoding
- assert b'/**/' == added.styleSheet.cssText
+ assert '/**/' == added.styleSheet.cssText
def test_insertRule(self):
"CSSStyleSheet.insertRule()"
@@ -847,7 +847,7 @@ def test_HTMLComments(self):
color: pink
}'''
sheet = cssutils.parseString(css)
- assert sheet.cssText == exp.encode()
+ assert sheet.cssText == exp
def test_incomplete(self):
"CSSStyleRule (incomplete)"
diff --git a/tests/test_cssutils.py b/tests/test_cssutils.py
index 918683f5..f1f92b33 100644
--- a/tests/test_cssutils.py
+++ b/tests/test_cssutils.py
@@ -32,11 +32,11 @@ def test_parseString(self):
)
assert isinstance(s, cssutils.css.CSSStyleSheet)
assert s.href is None
- assert self.exp.encode() == s.cssText
+ assert self.exp == s.cssText
assert 'utf-8' == s.encoding
assert 'handheld, screen' == s.media.mediaText
assert 'from string' == s.title
- assert self.exp.encode() == s.cssText
+ assert self.exp == s.cssText
ir = s.cssRules[0]
assert 'import/import2.css' == ir.href
@@ -53,17 +53,17 @@ def test_parseString(self):
irs = ir.styleSheet
assert isinstance(irs, cssutils.css.CSSStyleSheet)
assert (
- irs.cssText == b'@import "../import3.css";\n'
- b'@import "import-impossible.css" print;\n.import2 {\n'
- b' /* sheets/import2.css */\n'
- b' background: url(http://example.com/images/example.gif);\n'
- b' background: url(//example.com/images/example.gif);\n'
- b' background: url(/images/example.gif);\n'
- b' background: url(images2/example.gif);\n'
- b' background: url(./images2/example.gif);\n'
- b' background: url(../images/example.gif);\n'
- b' background: url(./../images/example.gif)\n'
- b' }'
+ irs.cssText == '@import "../import3.css";\n'
+ '@import "import-impossible.css" print;\n.import2 {\n'
+ ' /* sheets/import2.css */\n'
+ ' background: url(http://example.com/images/example.gif);\n'
+ ' background: url(//example.com/images/example.gif);\n'
+ ' background: url(/images/example.gif);\n'
+ ' background: url(images2/example.gif);\n'
+ ' background: url(./images2/example.gif);\n'
+ ' background: url(../images/example.gif);\n'
+ ' background: url(./../images/example.gif)\n'
+ ' }'
)
tests = {
@@ -90,25 +90,25 @@ def test_parseFile(self, monkeypatch):
assert 'utf-8' == s.encoding
assert 'screen' == s.media.mediaText
assert 'from file' == s.title
- assert self.exp.encode() == s.cssText
+ assert self.exp == s.cssText
ir = s.cssRules[0]
assert 'import/import2.css' == ir.href
irs = ir.styleSheet
assert isinstance(irs, cssutils.css.CSSStyleSheet)
assert (
- irs.cssText == b'@import "../import3.css";\n'
- b'@import "import-impossible.css" print;\n'
- b'.import2 {\n'
- b' /* sheets/import2.css */\n'
- b' background: url(http://example.com/images/example.gif);\n'
- b' background: url(//example.com/images/example.gif);\n'
- b' background: url(/images/example.gif);\n'
- b' background: url(images2/example.gif);\n'
- b' background: url(./images2/example.gif);\n'
- b' background: url(../images/example.gif);\n'
- b' background: url(./../images/example.gif)\n'
- b' }'
+ irs.cssText == '@import "../import3.css";\n'
+ '@import "import-impossible.css" print;\n'
+ '.import2 {\n'
+ ' /* sheets/import2.css */\n'
+ ' background: url(http://example.com/images/example.gif);\n'
+ ' background: url(//example.com/images/example.gif);\n'
+ ' background: url(/images/example.gif);\n'
+ ' background: url(images2/example.gif);\n'
+ ' background: url(./images2/example.gif);\n'
+ ' background: url(../images/example.gif);\n'
+ ' background: url(./../images/example.gif)\n'
+ ' }'
)
# name is used for open and setting of href automatically
@@ -128,25 +128,25 @@ def test_parseFile(self, monkeypatch):
assert 'utf-8' == s.encoding
assert 'screen' == s.media.mediaText
assert 'from file' == s.title
- assert self.exp.encode() == s.cssText
+ assert self.exp == s.cssText
ir = s.cssRules[0]
assert 'import/import2.css' == ir.href
irs = ir.styleSheet
assert isinstance(irs, cssutils.css.CSSStyleSheet)
assert (
- irs.cssText == b'@import "../import3.css";\n'
- b'@import "import-impossible.css" print;\n'
- b'.import2 {\n'
- b' /* sheets/import2.css */\n'
- b' background: url(http://example.com/images/example.gif);\n'
- b' background: url(//example.com/images/example.gif);\n'
- b' background: url(/images/example.gif);\n'
- b' background: url(images2/example.gif);\n'
- b' background: url(./images2/example.gif);\n'
- b' background: url(../images/example.gif);\n'
- b' background: url(./../images/example.gif)\n'
- b' }'
+ irs.cssText == '@import "../import3.css";\n'
+ '@import "import-impossible.css" print;\n'
+ '.import2 {\n'
+ ' /* sheets/import2.css */\n'
+ ' background: url(http://example.com/images/example.gif);\n'
+ ' background: url(//example.com/images/example.gif);\n'
+ ' background: url(/images/example.gif);\n'
+ ' background: url(images2/example.gif);\n'
+ ' background: url(./images2/example.gif);\n'
+ ' background: url(../images/example.gif);\n'
+ ' background: url(./../images/example.gif)\n'
+ ' }'
)
# next test
@@ -199,7 +199,7 @@ def test_parseUrl(self):
s = cssutils.parseUrl(href, media='tv, print', title='from url')
assert isinstance(s, cssutils.css.CSSStyleSheet)
assert href == s.href
- assert self.exp.encode() == s.cssText
+ assert self.exp == s.cssText
assert 'utf-8' == s.encoding
assert 'tv, print' == s.media.mediaText
assert 'from url' == s.title
@@ -212,33 +212,33 @@ def test_parseUrl(self):
assert 'import/import2.css' == ir.href
irs = ir.styleSheet
assert (
- irs.cssText == b'@import "../import3.css";\n'
- b'@import "import-impossible.css" print;\n'
- b'.import2 {\n'
- b' /* sheets/import2.css */\n'
- b' background: url(http://example.com/images/example.gif);\n'
- b' background: url(//example.com/images/example.gif);\n'
- b' background: url(/images/example.gif);\n'
- b' background: url(images2/example.gif);\n'
- b' background: url(./images2/example.gif);\n'
- b' background: url(../images/example.gif);\n'
- b' background: url(./../images/example.gif)\n'
- b' }'
+ irs.cssText == '@import "../import3.css";\n'
+ '@import "import-impossible.css" print;\n'
+ '.import2 {\n'
+ ' /* sheets/import2.css */\n'
+ ' background: url(http://example.com/images/example.gif);\n'
+ ' background: url(//example.com/images/example.gif);\n'
+ ' background: url(/images/example.gif);\n'
+ ' background: url(images2/example.gif);\n'
+ ' background: url(./images2/example.gif);\n'
+ ' background: url(../images/example.gif);\n'
+ ' background: url(./../images/example.gif)\n'
+ ' }'
)
ir2 = irs.cssRules[0]
assert '../import3.css' == ir2.href
irs2 = ir2.styleSheet
assert (
- irs2.cssText == b'/* import3 */\n'
- b'.import3 {\n'
- b' /* from ./import/../import3.css */\n'
- b' background: url(images/example3.gif);\n'
- b' background: url(./images/example3.gif);\n'
- b' background: url(import/images2/example2.gif);\n'
- b' background: url(./import/images2/example2.gif);\n'
- b' background: url(import/images2/../../images/example3.gif)\n'
- b' }'
+ irs2.cssText == '/* import3 */\n'
+ '.import3 {\n'
+ ' /* from ./import/../import3.css */\n'
+ ' background: url(images/example3.gif);\n'
+ ' background: url(./images/example3.gif);\n'
+ ' background: url(import/images2/example2.gif);\n'
+ ' background: url(./import/images2/example2.gif);\n'
+ ' background: url(import/images2/../../images/example3.gif)\n'
+ ' }'
)
def test_setCSSSerializer(self):
@@ -250,13 +250,13 @@ def test_setCSSSerializer(self):
exp1 = '''a {
left: 0
}'''
- assert exp4.encode() == s.cssText
+ assert exp4 == s.cssText
newser = cssutils.CSSSerializer(cssutils.serialize.Preferences(indent=' '))
cssutils.setSerializer(newser)
- assert exp1.encode() == s.cssText
+ assert exp1 == s.cssText
newser = cssutils.CSSSerializer(cssutils.serialize.Preferences(indent=' '))
cssutils.ser = newser
- assert exp4.encode() == s.cssText
+ assert exp4 == s.cssText
def test_parseStyle(self):
"cssutils.parseStyle()"
@@ -362,7 +362,7 @@ def test_resolveImports(self):
a = '@charset "iso-8859-1";@import"b.css";\xe4{color:green}'.encode(
'iso-8859-1'
)
- b = b'@charset "ascii";\\E4 {color:red}'
+ b = '@charset "ascii";\\E4 {color:red}'
# normal
m = mock.Mock()
@@ -370,17 +370,15 @@ def test_resolveImports(self):
m.return_value = (None, b)
s = cssutils.parseString(a)
- # py3 TODO
- assert a == s.cssText
+ assert a.decode('iso-8859-1') == s.cssText
assert b == s.cssRules[1].styleSheet.cssText
c = cssutils.resolveImports(s)
- # py3 TODO
- assert b'\xc3\xa4{color:red}\xc3\xa4{color:green}' == c.cssText
+ assert '\xe4{color:red}\xe4{color:green}' == c.cssText
c.encoding = 'ascii'
- assert rb'@charset "ascii";\E4 {color:red}\E4 {color:green}' == c.cssText
+ assert r'@charset "ascii";\E4 {color:red}\E4 {color:green}' == c.cssText
# b cannot be found
m = mock.Mock()
@@ -388,12 +386,10 @@ def test_resolveImports(self):
m.return_value = (None, None)
s = cssutils.parseString(a)
- # py3 TODO
- assert a == s.cssText
+ assert a.decode('iso-8859-1') == s.cssText
assert isinstance(s.cssRules[1].styleSheet, cssutils.css.CSSStyleSheet)
c = cssutils.resolveImports(s)
- # py3 TODO
- assert b'@import"b.css";\xc3\xa4{color:green}' == c.cssText
+ assert '@import"b.css";\xe4{color:green}' == c.cssText
# @import with media
a = '@import"b.css";@import"b.css" print, tv ;@import"b.css" all;'
@@ -405,7 +401,7 @@ def test_resolveImports(self):
c = cssutils.resolveImports(s)
- assert b'a{color:red}@media print,tv{a{color:red}}a{color:red}' == c.cssText
+ assert 'a{color:red}@media print,tv{a{color:red}}a{color:red}' == c.cssText
# cannot resolve with media => keep original
a = '@import"b.css"print;'
@@ -415,7 +411,7 @@ def test_resolveImports(self):
m.return_value = (None, b)
s = cssutils.parseString(a)
c = cssutils.resolveImports(s)
- assert a.encode() == c.cssText
+ assert a == c.cssText
# urls are adjusted too, layout:
# a.css
@@ -460,7 +456,7 @@ def do():
cssutils.ser.prefs.useDefaults()
cssutils.ser.prefs.keepComments = False
- expected = b'''c {
+ expected = '''c {
x: url(/img/abs.gif);
y: url(img/img.gif);
z: url(b/subimg/subimg.gif)
diff --git a/tests/test_cssvariablesdeclaration.py b/tests/test_cssvariablesdeclaration.py
index e1d91957..0b4bff81 100644
--- a/tests/test_cssvariablesdeclaration.py
+++ b/tests/test_cssvariablesdeclaration.py
@@ -254,7 +254,7 @@ def fetcher(url):
cssutils.ser.prefs.resolveVariables = False
assert (
s.cssText
- == b'''@import "1.css";
+ == '''@import "1.css";
@variables {
over3-2-1-0: 0;
over3-2-0: 0;
@@ -287,7 +287,7 @@ def fetcher(url):
cssutils.ser.prefs.resolveVariables = True
assert (
s.cssText
- == b'''@import "1.css";
+ == '''@import "1.css";
a {
local0: 0;
local1: 1;
@@ -309,7 +309,7 @@ def fetcher(url):
s = cssutils.resolveImports(s)
assert (
s.cssText
- == b'''/* START @import "1.css" */
+ == '''/* START @import "1.css" */
/* START @import "3.css" */
/* START @import "2.css" */
a {
diff --git a/tests/test_medialist.py b/tests/test_medialist.py
index 25b100e2..59236740 100644
--- a/tests/test_medialist.py
+++ b/tests/test_medialist.py
@@ -113,7 +113,7 @@ def test_append2All(self):
ml.appendMedium('print')
sheet = cssutils.parseString('@media all, print { /**/ }')
- assert b'@media all {\n /**/\n }' == sheet.cssText
+ assert '@media all {\n /**/\n }' == sheet.cssText
def test_delete(self):
"MediaList.deleteMedium()"
diff --git a/tests/test_parse.py b/tests/test_parse.py
index bc2d7c78..83129264 100644
--- a/tests/test_parse.py
+++ b/tests/test_parse.py
@@ -28,12 +28,12 @@ def test_init(self):
# default non raising parser
p = cssutils.CSSParser()
s = p.parseString('$')
- assert s.cssText == b''
+ assert s.cssText == ''
# explicit raiseExceptions=False
p = cssutils.CSSParser(raiseExceptions=False)
s = p.parseString('$')
- assert s.cssText == b''
+ assert s.cssText == ''
# working with sheet does raise though!
with pytest.raises(xml.dom.DOMException):
@@ -56,16 +56,16 @@ def test_init(self):
s = cssutils.css.CSSStyleSheet()
# does not raise!
s.__setattr__('cssText', '$')
- assert s.cssText == b''
+ assert s.cssText == ''
def test_parseComments(self):
"cssutils.CSSParser(parseComments=False)"
css = '/*1*/ a { color: /*2*/ red; }'
p = cssutils.CSSParser(parseComments=False)
- assert p.parseString(css).cssText == b'a {\n color: red\n }'
+ assert p.parseString(css).cssText == 'a {\n color: red\n }'
p = cssutils.CSSParser(parseComments=True)
- assert p.parseString(css).cssText == b'/*1*/\na {\n color: /*2*/ red\n }'
+ assert p.parseString(css).cssText == '/*1*/\na {\n color: /*2*/ red\n }'
def test_parseUrl(self):
"CSSParser.parseUrl()"
@@ -113,16 +113,14 @@ def test_parseUrl(self):
sheet2 = parser.parseUrl(url, encoding=override)
if isSheet:
assert sheet1.encoding == expencoding
- assert sheet1.cssText == cssText.encode()
+ assert sheet1.cssText == cssText
assert sheet2.encoding == override
if sheet1.cssText and cssText.startswith('@charset'):
- assert sheet2.cssText == (
- cssText.replace('ascii', override).encode()
- )
+ assert sheet2.cssText == (cssText.replace('ascii', override))
elif sheet1.cssText:
- assert sheet2.cssText == (overrideprefix + '\n' + cssText).encode()
+ assert sheet2.cssText == (overrideprefix + '\n' + cssText)
else:
- assert sheet2.cssText == (overrideprefix + cssText).encode()
+ assert sheet2.cssText == (overrideprefix + cssText)
else:
assert sheet1 is None
assert sheet2 is None
@@ -144,66 +142,66 @@ def test_parseString(self):
"CSSParser.parseString()"
tests = {
# (byte) string, encoding: encoding, cssText
- ('/*a*/', None): ('utf-8', b'/*a*/'),
- ('/*a*/', 'ascii'): ('ascii', b'@charset "ascii";\n/*a*/'),
+ ('/*a*/', None): ('utf-8', '/*a*/'),
+ ('/*a*/', 'ascii'): ('ascii', '@charset "ascii";\n/*a*/'),
# org
# ('/*\xc3\xa4*/', None): (u'utf-8', u'/*\xc3\xa4*/'.encode('utf-8')),
# ('/*\xc3\xa4*/', 'utf-8'): (u'utf-8',
# u'@charset "utf-8";\n/*\xc3\xa4*/'.encode('utf-8')),
# new for 2.x and 3.x
- ('/*\xe4*/'.encode(), None): ('utf-8', '/*\xe4*/'.encode()),
+ ('/*\xe4*/'.encode(), None): ('utf-8', '/*\xe4*/'),
('/*\xe4*/'.encode(), 'utf-8'): (
'utf-8',
- '@charset "utf-8";\n/*\xe4*/'.encode(),
+ '@charset "utf-8";\n/*\xe4*/',
),
('@charset "ascii";/*a*/', None): (
'ascii',
- b'@charset "ascii";\n/*a*/',
+ '@charset "ascii";\n/*a*/',
),
('@charset "utf-8";/*a*/', None): (
'utf-8',
- b'@charset "utf-8";\n/*a*/',
+ '@charset "utf-8";\n/*a*/',
),
('@charset "iso-8859-1";/*a*/', None): (
'iso-8859-1',
- b'@charset "iso-8859-1";\n/*a*/',
+ '@charset "iso-8859-1";\n/*a*/',
),
# unicode string, no encoding: encoding, cssText
- ('/*€*/', None): ('utf-8', '/*€*/'.encode()),
+ ('/*€*/', None): ('utf-8', '/*€*/'),
('@charset "iso-8859-1";/*ä*/', None): (
'iso-8859-1',
- '@charset "iso-8859-1";\n/*ä*/'.encode('iso-8859-1'),
+ '@charset "iso-8859-1";\n/*ä*/',
),
('@charset "utf-8";/*€*/', None): (
'utf-8',
- '@charset "utf-8";\n/*€*/'.encode(),
+ '@charset "utf-8";\n/*€*/',
),
('@charset "utf-16";/**/', None): (
'utf-16',
- '@charset "utf-16";\n/**/'.encode('utf-16'),
+ '@charset "utf-16";\n/**/',
),
# unicode string, encoding utf-8: encoding, cssText
- ('/*€*/', 'utf-8'): ('utf-8', '@charset "utf-8";\n/*€*/'.encode()),
+ ('/*€*/', 'utf-8'): ('utf-8', '@charset "utf-8";\n/*€*/'),
('@charset "iso-8859-1";/*ä*/', 'utf-8'): (
'utf-8',
- '@charset "utf-8";\n/*ä*/'.encode(),
+ '@charset "utf-8";\n/*ä*/',
),
('@charset "utf-8";/*€*/', 'utf-8'): (
'utf-8',
- '@charset "utf-8";\n/*€*/'.encode(),
+ '@charset "utf-8";\n/*€*/',
),
('@charset "utf-16";/**/', 'utf-8'): (
'utf-8',
- b'@charset "utf-8";\n/**/',
+ '@charset "utf-8";\n/**/',
),
# probably not what is wanted but does not raise:
('/*€*/', 'ascii'): (
'ascii',
- b'@charset "ascii";\n/*\\20AC */',
+ '@charset "ascii";\n/*\\20AC */',
),
('/*€*/', 'iso-8859-1'): (
'iso-8859-1',
- b'@charset "iso-8859-1";\n/*\\20AC */',
+ '@charset "iso-8859-1";\n/*\\20AC */',
),
}
for test in tests:
@@ -218,7 +216,6 @@ def test_parseString(self):
('/*€*/'.encode('utf-16'), 'utf-8'),
('/*ä*/'.encode('iso-8859-1'), 'ascii'),
('/*€*/'.encode(), 'ascii'),
- (b'a', 'utf-16'),
]
for test in tests:
# self.assertEqual(None, cssutils.parseString(css, encoding=encoding))
@@ -310,7 +307,7 @@ def test_fetcher(self):
'@charset "utf-16"; @import "x";',
'ASCII',
('iso-8859-1', '@charset "latin1";/*t*/'),
- ): ('ascii', 1, 'ascii', b'@charset "ascii";\n/*t*/'),
+ ): ('ascii', 1, 'ascii', '@charset "ascii";\n/*t*/'),
# 1/1 not tested her but same as next
# 2/1 @charset/HTTP => UTF-16/ISO-8859-1
(
@@ -321,7 +318,7 @@ def test_fetcher(self):
'utf-16',
1,
'iso-8859-1',
- b'@charset "iso-8859-1";\n/*t*/',
+ '@charset "iso-8859-1";\n/*t*/',
),
# 2/2 @charset/@charset => UTF-16/ISO-8859-1
(
@@ -332,55 +329,55 @@ def test_fetcher(self):
'utf-16',
1,
'iso-8859-1',
- b'@charset "iso-8859-1";\n/*t*/',
+ '@charset "iso-8859-1";\n/*t*/',
),
# 2/4 @charset/referrer => ASCII/ASCII
('@charset "ASCII"; @import "x";', None, (None, '/*t*/')): (
'ascii',
1,
'ascii',
- b'@charset "ascii";\n/*t*/',
+ '@charset "ascii";\n/*t*/',
),
# 5/5 default/default or referrer
('@import "x";', None, (None, '/*t*/')): (
'utf-8',
0,
'utf-8',
- b'/*t*/',
+ '/*t*/',
),
# 0/0 override/override+unicode
(
'@charset "utf-16"; @import "x";',
'ASCII',
(None, '@charset "latin1";/*\u0287*/'),
- ): ('ascii', 1, 'ascii', b'@charset "ascii";\n/*\\287 */'),
+ ): ('ascii', 1, 'ascii', '@charset "ascii";\n/*\\287 */'),
# 2/1 @charset/HTTP+unicode
('@charset "ascii"; @import "x";', None, ('iso-8859-1', '/*\u0287*/')): (
'ascii',
1,
'iso-8859-1',
- b'@charset "iso-8859-1";\n/*\\287 */',
+ '@charset "iso-8859-1";\n/*\\287 */',
),
# 2/4 @charset/referrer+unicode
('@charset "ascii"; @import "x";', None, (None, '/*\u0287*/')): (
'ascii',
1,
'ascii',
- b'@charset "ascii";\n/*\\287 */',
+ '@charset "ascii";\n/*\\287 */',
),
# 5/1 default/HTTP+unicode
('@import "x";', None, ('ascii', '/*\u0287*/')): (
'utf-8',
0,
'ascii',
- b'@charset "ascii";\n/*\\287 */',
+ '@charset "ascii";\n/*\\287 */',
),
# 5/5 default+unicode/default+unicode
('@import "x";', None, (None, '/*\u0287*/')): (
'utf-8',
0,
'utf-8',
- '/*\u0287*/'.encode(),
+ '/*\u0287*/',
),
}
parser = cssutils.CSSParser()
@@ -410,14 +407,14 @@ def test_roundtrip(self):
css1 = r'''@charset "utf-8";
/* ä */'''
s = cssutils.parseString(css1)
- css2 = str(s.cssText, 'utf-8')
+ css2 = s.cssText
assert css1 == css2
s = cssutils.parseString(css2)
s.cssRules[0].encoding = 'ascii'
css3 = r'''@charset "ascii";
/* \E4 */'''
- assert css3 == str(s.cssText, 'utf-8')
+ assert css3 == s.cssText
def test_escapes(self):
"cssutils escapes"
@@ -425,7 +422,7 @@ def test_escapes(self):
sheet = cssutils.parseString(css)
assert (
sheet.cssText
- == rb'''C\x {
+ == r'''C\x {
c\x: C\x !important
}'''
)
@@ -434,7 +431,7 @@ def test_escapes(self):
sheet = cssutils.parseString(css)
assert (
sheet.cssText
- == rb'''\ x {
+ == r'''\ x {
\ x: \ x;
y: 1
}'''
@@ -465,7 +462,7 @@ def test_invalidstring(self):
)
for css in csss:
s = cssutils.parseString(css)
- assert validfromhere.encode() == s.cssText
+ assert validfromhere == s.cssText
csss = (
'''a { font-family: "Courier
@@ -476,7 +473,7 @@ def test_invalidstring(self):
''',
)
for css in csss:
- assert b'' == cssutils.parseString(css).cssText
+ assert '' == cssutils.parseString(css).cssText
def test_invalid(self):
"cssutils.parseString(INVALID_CSS)"
@@ -495,7 +492,7 @@ def test_invalid(self):
if exp is None:
exp = css
s = cssutils.parseString(css)
- assert exp.encode() == s.cssText
+ assert exp == s.cssText
def test_nesting(self):
"cssutils.parseString nesting"
@@ -511,7 +508,7 @@ def test_nesting(self):
'@1 { [ } ] div{color:red}div{color:green}': 'div {\n color: green\n }',
}
for css, exp in list(tests.items()):
- assert exp.encode() == cssutils.parseString(css).cssText
+ assert exp == cssutils.parseString(css).cssText
def test_specialcases(self):
"cssutils.parseString(special_case)"
@@ -527,7 +524,7 @@ def test_specialcases(self):
if exp is None:
exp = css
s = cssutils.parseString(css)
- assert exp.encode() == s.cssText
+ assert exp == s.cssText
def test_iehack(self):
"IEhack: $property (not since 0.9.5b3)"
diff --git a/tests/test_scripts_csscombine.py b/tests/test_scripts_csscombine.py
index 9e975620..a3c9de0e 100644
--- a/tests/test_scripts_csscombine.py
+++ b/tests/test_scripts_csscombine.py
@@ -15,16 +15,16 @@ def test_combine(self):
# path, SHOULD be keyword argument!
csspath = basetest.get_sheet_filename('csscombine-proxy.css')
combined = csscombine(csspath)
- assert combined == self.C.encode()
+ assert combined == self.C
combined = csscombine(path=csspath, targetencoding='ascii')
- assert combined == ('@charset "ascii";' + self.C).encode()
+ assert combined == '@charset "ascii";' + self.C
# url
cssurl = cssutils.helper.path2url(csspath)
combined = csscombine(url=cssurl)
- assert combined == self.C.encode()
+ assert combined == self.C
combined = csscombine(url=cssurl, targetencoding='ascii')
- assert combined == ('@charset "ascii";' + self.C).encode()
+ assert combined == '@charset "ascii";' + self.C
# cssText
# TODO: really need binary or can handle str too?
@@ -32,9 +32,9 @@ def test_combine(self):
cssText = f.read()
f.close()
combined = csscombine(cssText=cssText, href=cssurl)
- assert combined == self.C.encode()
+ assert combined == self.C
combined = csscombine(cssText=cssText, href=cssurl, targetencoding='ascii')
- assert combined == ('@charset "ascii";' + self.C).encode()
+ assert combined == '@charset "ascii";' + self.C
def test_combine_resolveVariables(self):
"scripts.csscombine(minify=..., resolveVariables=...)"
@@ -50,15 +50,15 @@ def test_combine_resolveVariables(self):
# default minify
assert (
csscombine(cssText=cssText, resolveVariables=False)
- == b'@variables{c:#0f0}a{color:var(c)}'
+ == '@variables{c:#0f0}a{color:var(c)}'
)
- assert csscombine(cssText=cssText) == b'a{color:#0f0}'
+ assert csscombine(cssText=cssText) == 'a{color:#0f0}'
# no minify
assert (
csscombine(cssText=cssText, minify=False, resolveVariables=False)
- == b'@variables {\n c: #0f0\n }\na {\n color: var(c)\n }'
+ == '@variables {\n c: #0f0\n }\na {\n color: var(c)\n }'
)
assert (
- csscombine(cssText=cssText, minify=False) == b'a {\n color: #0f0\n }'
+ csscombine(cssText=cssText, minify=False) == 'a {\n color: #0f0\n }'
)
diff --git a/tests/test_selector.py b/tests/test_selector.py
index da1f40fc..39cec294 100644
--- a/tests/test_selector.py
+++ b/tests/test_selector.py
@@ -127,13 +127,13 @@ def test_default_namespace(self):
sheet = cssutils.css.CSSStyleSheet()
sheet.cssText = css
assert (
- sheet.cssText == b'@namespace "default";\na[att] {\n color: green\n }'
+ sheet.cssText == '@namespace "default";\na[att] {\n color: green\n }'
)
# use a prefix for default namespace, does not goes for atts!
sheet.namespaces['p'] = 'default'
assert (
sheet.cssText
- == b'@namespace p "default";\np|a[att] {\n color: green\n }'
+ == '@namespace p "default";\np|a[att] {\n color: green\n }'
)
def test_parent(self):
diff --git a/tests/test_serialize.py b/tests/test_serialize.py
index 92549023..8d2bf2da 100644
--- a/tests/test_serialize.py
+++ b/tests/test_serialize.py
@@ -40,7 +40,7 @@ def test_resolveVariables(self):
for test, exp in list(tests.items()):
s = cssutils.parseString(vars + test)
- assert exp.encode() == s.cssText
+ assert exp == s.cssText
cssutils.ser.prefs.resolveVariables = True
@@ -105,7 +105,7 @@ def test_useDefaults(self):
font-family: arial, "some"
}'''
s = cssutils.parseString(css)
- assert s.cssText == parsedcss.encode()
+ assert s.cssText == parsedcss
tests = {
'0.1 .1 0.1px .1px 0.1% .1% +0.1 +.1 +0.1px +.1px +0.1% +.1% '
@@ -115,7 +115,7 @@ def test_useDefaults(self):
cssutils.ser.prefs.useDefaults()
for test, exp in list(tests.items()):
s = cssutils.parseString('a{x:%s}' % test)
- assert ('a {\n x: %s\n }' % exp).encode() == s.cssText
+ assert ('a {\n x: %s\n }' % exp) == s.cssText
def test_useMinified(self):
"Preferences.useMinified()"
@@ -165,16 +165,16 @@ def test_useMinified(self):
cssutils.ser.prefs.keepUnknownAtRules = True
assert (
s.cssText
- == b'''@import"x"tv,print;@namespace prefix"uri";@media all"name"'''
- b'''{a{color:red}}@page :left{left:0}prefix|x,a+b>c~d,b{top:1px;'''
- b'''font-family:arial,"some"}@x x;'''
+ == '''@import"x"tv,print;@namespace prefix"uri";@media all"name"'''
+ '''{a{color:red}}@page :left{left:0}prefix|x,a+b>c~d,b{top:1px;'''
+ '''font-family:arial,"some"}@x x;'''
)
cssutils.ser.prefs.keepUnknownAtRules = False
assert (
s.cssText
- == b'''@import"x"tv,print;@namespace prefix"uri";@media all"name"'''
- b'''{a{color:red}}@page :left{left:0}prefix|x,a+b>c~d,b{top:1px;'''
- b'''font-family:arial,"some"}'''
+ == '''@import"x"tv,print;@namespace prefix"uri";@media all"name"'''
+ '''{a{color:red}}@page :left{left:0}prefix|x,a+b>c~d,b{top:1px;'''
+ '''font-family:arial,"some"}'''
)
# Values
valuetests = {
@@ -199,16 +199,16 @@ def test_useMinified(self):
}
for test, exp in list(valuetests.items()):
s = cssutils.parseString('a{x:%s}' % test)
- assert ('a{x:%s}' % exp).encode() == s.cssText
+ assert ('a{x:%s}' % exp) == s.cssText
def test_defaultAtKeyword(self):
"Preferences.defaultAtKeyword"
s = cssutils.parseString('@im\\port "x";')
- assert b'@import "x";' == s.cssText
+ assert '@import "x";' == s.cssText
cssutils.ser.prefs.defaultAtKeyword = True
- assert b'@import "x";' == s.cssText
+ assert '@import "x";' == s.cssText
cssutils.ser.prefs.defaultAtKeyword = False
- assert b'@im\\port "x";' == s.cssText
+ assert '@im\\port "x";' == s.cssText
def test_defaultPropertyName(self):
"Preferences.defaultPropertyName"
@@ -218,26 +218,26 @@ def test_defaultPropertyName(self):
# if used with a backslash in it later...
s = cssutils.parseString(r'a { c\olor: green; }')
- assert b'a {\n color: green\n }' == s.cssText
+ assert 'a {\n color: green\n }' == s.cssText
cssutils.ser.prefs.defaultPropertyName = True
- assert b'a {\n color: green\n }' == s.cssText
+ assert 'a {\n color: green\n }' == s.cssText
cssutils.ser.prefs.defaultPropertyName = False
- assert b'a {\n c\\olor: green\n }' == s.cssText
+ assert 'a {\n c\\olor: green\n }' == s.cssText
s = cssutils.parseString(r'a { color: red; c\olor: green; }')
- assert b'a {\n c\\olor: green\n }' == s.cssText
+ assert 'a {\n c\\olor: green\n }' == s.cssText
cssutils.ser.prefs.defaultPropertyName = False
- assert b'a {\n c\\olor: green\n }' == s.cssText
+ assert 'a {\n c\\olor: green\n }' == s.cssText
cssutils.ser.prefs.defaultPropertyName = True
- assert b'a {\n color: green\n }' == s.cssText
+ assert 'a {\n color: green\n }' == s.cssText
def test_defaultPropertyPriority(self):
"Preferences.defaultPropertyPriority"
css = 'a {\n color: green !IM\\portant\n }'
s = cssutils.parseString(css)
- assert s.cssText == b'a {\n color: green !important\n }'
+ assert s.cssText == 'a {\n color: green !important\n }'
cssutils.ser.prefs.defaultPropertyPriority = False
- assert s.cssText == css.encode()
+ assert s.cssText == css
def test_importHrefFormat(self):
"Preferences.importHrefFormat"
@@ -270,9 +270,9 @@ def test_indent(self):
left: 0
}'''
cssutils.ser.prefs.indent = ' '
- assert exp1.encode() == s.cssText
+ assert exp1 == s.cssText
cssutils.ser.prefs.indent = 4 * ' '
- assert exp4.encode() == s.cssText
+ assert exp4 == s.cssText
def test_indentClosingBrace(self):
"Preferences.indentClosingBrace"
@@ -294,9 +294,9 @@ def test_indentClosingBrace(self):
top: 0
}'''
cssutils.ser.prefs.useDefaults()
- assert expT.encode() == s.cssText
+ assert expT == s.cssText
cssutils.ser.prefs.indentClosingBrace = False
- assert expF.encode() == s.cssText
+ assert expF == s.cssText
def test_keepAllProperties(self):
"Preferences.keepAllProperties"
@@ -309,21 +309,21 @@ def test_keepAllProperties(self):
s = cssutils.parseString(css)
# keep only last
cssutils.ser.prefs.keepAllProperties = False
- assert b'a {\n color: green\n }' == s.cssText
+ assert 'a {\n color: green\n }' == s.cssText
# keep all
cssutils.ser.prefs.keepAllProperties = True
assert (
- b'a {\n color: pink;\n color: red;\n c\\olor: blue;\n '
- b'c\\olor: green\n }' == s.cssText
+ 'a {\n color: pink;\n color: red;\n c\\olor: blue;\n '
+ 'c\\olor: green\n }' == s.cssText
)
def test_keepComments(self):
"Preferences.keepComments"
s = cssutils.parseString('/*1*/ a { /*2*/ }')
cssutils.ser.prefs.keepComments = False
- assert b'' == s.cssText
+ assert '' == s.cssText
cssutils.ser.prefs.keepEmptyRules = True
- assert b'a {}' == s.cssText
+ assert 'a {}' == s.cssText
def test_keepEmptyRules(self):
"Preferences.keepEmptyRules"
@@ -338,11 +338,11 @@ def test_keepEmptyRules(self):
s = cssutils.parseString(css)
cssutils.ser.prefs.useDefaults()
cssutils.ser.prefs.keepEmptyRules = True
- assert css.encode() == s.cssText
+ assert css == s.cssText
cssutils.ser.prefs.keepEmptyRules = False
- assert b'a {\n /*1*/\n }\na {\n color: red\n }' == s.cssText
+ assert 'a {\n /*1*/\n }\na {\n color: red\n }' == s.cssText
cssutils.ser.prefs.keepComments = False
- assert b'a {\n color: red\n }' == s.cssText
+ assert 'a {\n color: red\n }' == s.cssText
# CSSMediaRule
css = '''@media tv {
@@ -369,7 +369,7 @@ def test_keepEmptyRules(self):
# self.assertEqual(css, s.cssText)
cssutils.ser.prefs.keepEmptyRules = False
assert (
- b'''@media all {
+ '''@media all {
/*1*/
}
@media print {
@@ -386,7 +386,7 @@ def test_keepEmptyRules(self):
)
cssutils.ser.prefs.keepComments = False
assert (
- b'''@media all {
+ '''@media all {
a {
color: red
}
@@ -425,9 +425,9 @@ def test_keepUnknownAtRules(self):
s = cssutils.parseString(test)
expwith, expwithout = tests[test]
cssutils.ser.prefs.keepUnknownAtRules = True
- assert s.cssText == expwith.encode()
+ assert s.cssText == expwith
cssutils.ser.prefs.keepUnknownAtRules = False
- assert s.cssText == expwithout.encode()
+ assert s.cssText == expwithout
def test_keepUsedNamespaceRulesOnly(self):
"Preferences.keepUsedNamespaceRulesOnly"
@@ -466,9 +466,9 @@ def test_keepUsedNamespaceRulesOnly(self):
s = cssutils.parseString(test)
expwith, expwithout = tests[test]
cssutils.ser.prefs.keepUsedNamespaceRulesOnly = False
- assert s.cssText == expwith.encode()
+ assert s.cssText == expwith
cssutils.ser.prefs.keepUsedNamespaceRulesOnly = True
- assert s.cssText == expwithout.encode()
+ assert s.cssText == expwithout
def test_lineNumbers(self):
"Preferences.lineNumbers"
@@ -483,21 +483,21 @@ def test_lineNumbers(self):
3: left: 2
4: }'''
assert not cssutils.ser.prefs.lineNumbers
- assert exp0.encode() == s.cssText
+ assert exp0 == s.cssText
cssutils.ser.prefs.lineNumbers = True
assert cssutils.ser.prefs.lineNumbers
- assert exp1.encode() == s.cssText
+ assert exp1 == s.cssText
def test_lineSeparator(self):
"Preferences.lineSeparator"
s = cssutils.parseString('a { x:1;y:2}')
- assert b'a {\n x: 1;\n y: 2\n }' == s.cssText
+ assert 'a {\n x: 1;\n y: 2\n }' == s.cssText
# cannot be indented as no split possible
cssutils.ser.prefs.lineSeparator = ''
- assert b'a {x: 1;y: 2 }' == s.cssText
+ assert 'a {x: 1;y: 2 }' == s.cssText
# no valid css but should work
cssutils.ser.prefs.lineSeparator = 'XXX'
- assert b'a {XXX x: 1;XXX y: 2XXX }' == s.cssText
+ assert 'a {XXX x: 1;XXX y: 2XXX }' == s.cssText
def test_listItemSpacer(self):
"Preferences.listItemSpacer"
@@ -507,25 +507,25 @@ def test_listItemSpacer(self):
@import "x" print, tv;
a, b {}'''
s = cssutils.parseString(css)
- assert b'@import "x" print, tv;\na, b {}' == s.cssText
+ assert '@import "x" print, tv;\na, b {}' == s.cssText
cssutils.ser.prefs.listItemSpacer = ''
- assert b'@import "x" print,tv;\na,b {}' == s.cssText
+ assert '@import "x" print,tv;\na,b {}' == s.cssText
def test_minimizeColorHash(self):
"Preferences.minimizeColorHash"
css = 'a { color: #ffffff }'
s = cssutils.parseString(css)
- assert b'a {\n color: #fff\n }' == s.cssText
+ assert 'a {\n color: #fff\n }' == s.cssText
cssutils.ser.prefs.minimizeColorHash = False
- assert b'a {\n color: #ffffff\n }' == s.cssText
+ assert 'a {\n color: #ffffff\n }' == s.cssText
def test_omitLastSemicolon(self):
"Preferences.omitLastSemicolon"
css = 'a { x: 1; y: 2 }'
s = cssutils.parseString(css)
- assert b'a {\n x: 1;\n y: 2\n }' == s.cssText
+ assert 'a {\n x: 1;\n y: 2\n }' == s.cssText
cssutils.ser.prefs.omitLastSemicolon = False
- assert b'a {\n x: 1;\n y: 2;\n }' == s.cssText
+ assert 'a {\n x: 1;\n y: 2;\n }' == s.cssText
def test_normalizedVarNames(self):
"Preferences.normalizedVarNames"
@@ -533,9 +533,9 @@ def test_normalizedVarNames(self):
css = '@variables { A: 1 }'
s = cssutils.parseString(css)
- assert b'@variables {\n a: 1\n }' == s.cssText
+ assert '@variables {\n a: 1\n }' == s.cssText
cssutils.ser.prefs.normalizedVarNames = False
- assert b'@variables {\n A: 1\n }' == s.cssText
+ assert '@variables {\n A: 1\n }' == s.cssText
cssutils.ser.prefs.resolveVariables = True
@@ -543,17 +543,17 @@ def test_paranthesisSpacer(self):
"Preferences.paranthesisSpacer"
css = 'a { x: 1; y: 2 }'
s = cssutils.parseString(css)
- assert b'a {\n x: 1;\n y: 2\n }' == s.cssText
+ assert 'a {\n x: 1;\n y: 2\n }' == s.cssText
cssutils.ser.prefs.paranthesisSpacer = ''
- assert b'a{\n x: 1;\n y: 2\n }' == s.cssText
+ assert 'a{\n x: 1;\n y: 2\n }' == s.cssText
def test_propertyNameSpacer(self):
"Preferences.propertyNameSpacer"
css = 'a { x: 1; y: 2 }'
s = cssutils.parseString(css)
- assert b'a {\n x: 1;\n y: 2\n }' == s.cssText
+ assert 'a {\n x: 1;\n y: 2\n }' == s.cssText
cssutils.ser.prefs.propertyNameSpacer = ''
- assert b'a {\n x:1;\n y:2\n }' == s.cssText
+ assert 'a {\n x:1;\n y:2\n }' == s.cssText
def test_selectorCombinatorSpacer(self):
"Preferences.selectorCombinatorSpacer"
@@ -575,7 +575,7 @@ def test_spacer(self):
'@import"x"tv': '@import"x"tv;', # ?
}
for css, exp in list(tests.items()):
- assert exp.encode() == cssutils.parseString(css).cssText
+ assert exp == cssutils.parseString(css).cssText
def test_validOnly(self):
"Preferences.validOnly"
@@ -661,14 +661,14 @@ def test_CSSStyleSheet(self):
"CSSSerializer.do_CSSStyleSheet"
css = '/* κουρος */'
sheet = cssutils.parseString(css)
- assert css == str(sheet.cssText, 'utf-8')
+ assert css == sheet.cssText
css = '@charset "utf-8";\n/* κουρος */'
sheet = cssutils.parseString(css)
- assert css == str(sheet.cssText, 'utf-8')
+ assert css == sheet.cssText
sheet.cssRules[0].encoding = 'ascii'
assert (
- b'@charset "ascii";\n/* \\3BA \\3BF \\3C5 \\3C1 \\3BF \\3C2 */'
+ '@charset "ascii";\n/* \\3BA \\3BF \\3C5 \\3C1 \\3BF \\3C2 */'
== sheet.cssText
)
@@ -728,4 +728,4 @@ def test_escapestring(self):
content: "'"
}'''
sheet = cssutils.parseString(css)
- assert sheet.cssText == exp.encode()
+ assert sheet.cssText == exp
diff --git a/tests/test_settings.py b/tests/test_settings.py
index 72fb34d7..486809d5 100644
--- a/tests/test_settings.py
+++ b/tests/test_settings.py
@@ -12,10 +12,10 @@ def test_set(self):
'a {filter: progid:DXImageTransform.Microsoft.BasicImage( rotation = 90 )}'
)
- assert cssutils.parseString(text).cssText == b''
+ assert cssutils.parseString(text).cssText == ''
cssutils.settings.set('DXImageTransform.Microsoft', True)
assert (
cssutils.parseString(text).cssText
- == b'a{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=90)}'
+ == 'a{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=90)}'
)
diff --git a/tests/test_x.py b/tests/test_x.py
index 660d7c17..a42f3bb7 100644
--- a/tests/test_x.py
+++ b/tests/test_x.py
@@ -12,7 +12,7 @@ class TestX:
def test_priority(self):
"Property.priority"
s = cssutils.parseString('a { color: red }')
- assert s.cssText == b'a {\n color: red\n }'
+ assert s.cssText == 'a {\n color: red\n }'
assert '' == s.cssRules[0].style.getPropertyPriority('color')