class TestFlags(unittest.TestCase): def setUp(self): self.flags = Flags('contentaccessible=yes', 'appversion>=3.5', 'application=foo', 'application=bar', 'appversion<2.0', 'platform', 'abi!=Linux_x86-gcc3') def test_flags_str(self): self.assertEqual(str(self.flags), 'contentaccessible=yes ' + 'appversion>=3.5 appversion<2.0 application=foo ' + 'application=bar platform abi!=Linux_x86-gcc3') def test_flags_match_unset(self): self.assertTrue(self.flags.match(os='WINNT')) def test_flags_match(self): self.assertTrue(self.flags.match(application='foo')) self.assertFalse(self.flags.match(application='qux')) def test_flags_match_different(self): self.assertTrue(self.flags.match(abi='WINNT_x86-MSVC')) self.assertFalse(self.flags.match(abi='Linux_x86-gcc3')) def test_flags_match_version(self): self.assertTrue(self.flags.match(appversion='1.0')) self.assertTrue(self.flags.match(appversion='1.5')) self.assertFalse(self.flags.match(appversion='2.0')) self.assertFalse(self.flags.match(appversion='3.0')) self.assertTrue(self.flags.match(appversion='3.5')) self.assertTrue(self.flags.match(appversion='3.10'))
class TestFlags(unittest.TestCase): def setUp(self): self.flags = Flags('contentaccessible=yes', 'appversion>=3.5', 'application=foo', 'application=bar', 'appversion<2.0', 'platform', 'abi!=Linux_x86-gcc3') def test_flags_str(self): self.assertEqual( str(self.flags), 'contentaccessible=yes ' + 'appversion>=3.5 appversion<2.0 application=foo ' + 'application=bar platform abi!=Linux_x86-gcc3') def test_flags_match_unset(self): self.assertTrue(self.flags.match(os='WINNT')) def test_flags_match(self): self.assertTrue(self.flags.match(application='foo')) self.assertFalse(self.flags.match(application='qux')) def test_flags_match_different(self): self.assertTrue(self.flags.match(abi='WINNT_x86-MSVC')) self.assertFalse(self.flags.match(abi='Linux_x86-gcc3')) def test_flags_match_version(self): self.assertTrue(self.flags.match(appversion='1.0')) self.assertTrue(self.flags.match(appversion='1.5')) self.assertFalse(self.flags.match(appversion='2.0')) self.assertFalse(self.flags.match(appversion='3.0')) self.assertTrue(self.flags.match(appversion='3.5')) self.assertTrue(self.flags.match(appversion='3.10'))
class TestFlags(unittest.TestCase): def setUp(self): self.flags = Flags( "contentaccessible=yes", "appversion>=3.5", "application=foo", "application=bar", "appversion<2.0", "platform", "abi!=Linux_x86-gcc3", ) def test_flags_str(self): self.assertEqual( str(self.flags), "contentaccessible=yes " + "appversion>=3.5 appversion<2.0 application=foo " + "application=bar platform abi!=Linux_x86-gcc3", ) def test_flags_match_unset(self): self.assertTrue(self.flags.match(os="WINNT")) def test_flags_match(self): self.assertTrue(self.flags.match(application="foo")) self.assertFalse(self.flags.match(application="qux")) def test_flags_match_different(self): self.assertTrue(self.flags.match(abi="WINNT_x86-MSVC")) self.assertFalse(self.flags.match(abi="Linux_x86-gcc3")) def test_flags_match_version(self): self.assertTrue(self.flags.match(appversion="1.0")) self.assertTrue(self.flags.match(appversion="1.5")) self.assertFalse(self.flags.match(appversion="2.0")) self.assertFalse(self.flags.match(appversion="3.0")) self.assertTrue(self.flags.match(appversion="3.5")) self.assertTrue(self.flags.match(appversion="3.10"))